OLINGO-846, OLINGO-1076: Expanding/relaxing the allowence of white space AFTER the query option is decoded. Also applying to name segment, note that this is only for user supplied queries

This commit is contained in:
Ramesh Reddy 2017-04-19 13:39:08 -05:00
parent 0cf76f51c5
commit 7e262c8d07
2 changed files with 6 additions and 3 deletions

View File

@ -48,11 +48,11 @@ public class UriDecoder {
for (final String option : split(queryOptionString, '&')) {
final int pos = option.indexOf('=');
final String name = pos >= 0 ? option.substring(0, pos) : option;
final String text = pos >= 0 ? option.substring(pos + 1) : "";
//OLINGO-846 We trim the query option text to be more lenient to wrong uri constructors
final String text = pos >= 0 ? option.substring(pos + 1).trim() : "";
queryOptions.add(new CustomQueryOptionImpl()
.setName(decode(name))
.setText(decode(text)));
.setName(decode(name).trim())
.setText(decode(text).trim()));
}
return queryOptions;
}

View File

@ -905,6 +905,9 @@ public class UriParserTest {
// OLINGO-846 trim query option value
testUri.run("ESAllPrim", "$filter= PropertyInt16 eq 12 ")
.isKind(UriInfoKind.resource).goFilter().isBinary(BinaryOperatorKind.EQ).is("<<PropertyInt16> eq <12>>");
testUri.run("ESAllPrim", "%20$filter%20=%20PropertyInt16%20%20eq%2012%20")
.isKind(UriInfoKind.resource).goFilter().isBinary(BinaryOperatorKind.EQ).is("<<PropertyInt16> eq <12>>");
}
@Test