balena-io-modules / pinejs-client-js

4 stars 4 forks source link

encodedSlash is not supported in filters #123

Open klutchell opened 3 years ago

klutchell commented 3 years ago

When escaping forward slashes in URL parameters with %2F the filters suggested in our documentation no longer work.

https://www.balena.io/docs/reference/api/resources/release_tag/

curl -X GET \
"https://api.balena-cloud.com/v6/release_tag?\$filter=release/commit%20eq%20'$COMMIT'" \ 
-H "Content-Type: application/json" \
-H "Authorization: Bearer $AUTH_TOKEN"  
{"d":[]}
curl -X GET \
"https://api.balena-cloud.com/v6/release_tag?\$filter=release%2Fcommit%20eq%20'$COMMIT'" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $AUTH_TOKEN"
"Malformed url: '/resin/release_tag?$filter=release%2Fcommit%20eq%20'0b8c2622831bc92c45cf558772ea496a'&$format=json;metadata=full'"%
jellyfish-bot commented 3 years ago

[klutchell] This issue has attached support thread https://jel.ly.fish/b9b2d5fc-da35-42b3-80bc-16c37ffa96c3

nitishagar commented 3 years ago

Similar issue on other escape characters like: , (example below)

curl -X GET "https://api.balena-cloud.com/v6/release?\$filter=commit%20eq%20''&\$select=id%2Ccommit" -H "Content-Type: application/json" -H "Authorization: Bearer "

$> "Malformed url: '/resin/release?$filter=commit%20eq%20''&$select=id%2Ccommit&$format=json;metadata=full'"%  

If we replace the %2C before the commit with a , - the query passes without issue.

sraturi commented 2 years ago

Any progress on this, its been a while, and was hoping this was fixed by now? It's impossible to use the filter and select queries with multiple parameters.

ninowalker commented 2 years ago

Any update on this? This is violating the RFC for proper URL escaping: this should be non-controversial and have a non-controversial fix.

stokes776 commented 1 year ago

Also adding in my hat to this. Any updates?

treygilliland commented 1 year ago

Yes it still seems percent encoding is still broken which makes the API nearly impossible to use from most API UI tools