Unstable processing encoded query string parameters in the AddQueriesToRequest
class
#1994
Replies: 4 comments 1 reply
-
Hi, I think it's related to this no? If I understood correctly you need a ampersand in the querystring right? from StackOverflow:
|
Beta Was this translation helpful? Give feedback.
-
Hey, Apologies, after rereading my initial post it definitely could of been clearer. The problem is that my query string has been correctly url encoded but the ClaimsToQueryString is removing said encoding. Lets imagine I have a route setup which uses the ClaimsToQuery functionality to add the subject claim to the query string Expected behaviour: If I have a query string of Actual behaviour: If I have a query string of Workaround: The current workaround I'm using is to double encode the query string values, as then if I have a query string of |
Beta Was this translation helpful? Give feedback.
-
Hi, I hava the same problem. |
Beta Was this translation helpful? Give feedback.
-
@scottambroseio @scottambroseio @MaChao9914 Finally, if Catch-All cannot help you then consider For now I can't accept this and can't consider this issue as Ocelot's bug, because of invalid arguments for Ocelot/src/Ocelot/QueryStrings/AddQueriesToRequest.cs Lines 49 to 55 in d6eefc8 We still use the helper but I don't see any help from you guys as ideas or PRs to improve the behavior. |
Beta Was this translation helpful? Give feedback.
-
Expected Behavior / New Feature
Hey all, I've come across what I believe is a bug with the ClaimsToQueryString handler.
Actual Behavior / Motivation for New Feature
If the query string has url encoded parameters (at the very least, url encoded ampersands), they end up getting decoded by this handler which will cause problems for downstream services.
Doing some brief investigation, I believe that the problem stems from this file and the fact that QueryHelpers.ParseQuery url decodes values.
https://github.com/ThreeMammals/Ocelot/blob/13.5.0/src/Ocelot/QueryStrings/AddQueriesToRequest.cs
Minimal code I threw together to display the issue
Specifications
The solution I'm using currently is to double encode the the value in the query string which works, it just feels a little wrong.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions