Skip to content

Commit

Permalink
Decode escaped URI
Browse files Browse the repository at this point in the history
Parser is not parsing for escaped characters like %27='(' or %28=')'

Change-type: patch
Signed-off-by: fisehara <[email protected]>
  • Loading branch information
fisehara committed Jan 3, 2024
1 parent bc8f92b commit 4107312
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions odata-parser.pegjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
{{
function uriDecodeFn() {
if (typeof window !== 'undefined') {
return decodeURI
} else {
const querystring = require('node:querystring');
return querystring.unescape
}
}
const uriDecode = uriDecodeFn();
}}

{
const methods = {
cast: [ 1, 2 ],
Expand Down Expand Up @@ -85,6 +97,7 @@
binds.push([type, value])
return { bind: binds.length - 1 }
}
input = uriDecode(input)
}

Process =
Expand Down Expand Up @@ -131,7 +144,6 @@ QueryOption =

Dollar '$ query options' =
'$'
/ '%24'

ParameterAliasOption =
'@' name:Text '='
Expand Down Expand Up @@ -645,15 +657,13 @@ Text =

Sign =
'+'
/ '%2B'
{ return '+' }
/ '-'
/ ''

// TODO: This should really be done treating everything the same, but for now this hack should allow FF to work passably.
Apostrophe =
'\''
/ '%27'
{ return '\'' }

QuotedText =
Expand Down Expand Up @@ -718,6 +728,5 @@ spaces =

space =
( ' '
/ '%20'
/ '+'
)

0 comments on commit 4107312

Please sign in to comment.