graphiti-api/spraypaint.js

Parameter encoding not working as expected.

Opened this issue · 1 comments

When sending filtering data through a where clause, the parameters are not being properly encoded:

value: this&that

Browser: Firefox 93.0 (64-bit) Mac OS Big Sur

Screen Shot 2021-10-21 at 11 35 40
Screen Shot 2021-10-21 at 11 35 55

Google Chrome 94.0.4606.81 (Official Build) (x86_64) (Big Sur)

Screen Shot 2021-10-21 at 11 37 44

Screen Shot 2021-10-21 at 11 38 02

Same issue in chrome: browser encodes it automatically except for ampersands, which break the query. Easily fixed in front end by pre-encoding the string, but makes for surprise edge cases with values that contain ampersands. I couldn't figure out any reason for spraypaint not to pre-encode the value regardless of browser, but maybe I'm missing something.

But I also think we should improve the check to minimize edge cases with a "%" that could also be problematic (see phyllipy#1 -- this tests for absence of encoded values (%[0-9a-z]{2}) and also confirms no un-encoded (but encodable) chars are in the text other than %.