-
-
Notifications
You must be signed in to change notification settings - Fork 4
fix: unescape keys to handle escaped special characters #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The App Config SDK sends i.e. feature flag keys as URL-encoded, even though their API also supports them being not URL-encoded. This URL-decodes them to match the behavior of live Azure App Config.
Hi @paulirwin, thank you for your contribution! After doing some testing, it looks like this causes issues with keys that contain a "+" character.
|
It looks like the decoding of the "/" character is a known unresolved issue in .NET according to this issue. |
Well that is strange behavior with App Config! I've updated this PR to account for that and added unit tests. |
Unfortunately I think that there might still be an issue with the changes.
|
We're starting to get into edge case territory. I highly doubt many people are using percent signs in their keys. I also highly doubt that at least the .NET SDK (if not others) is not URL-encoding those percents anyways. I could just replace a hard-coded list of URL-encoded tokens like %2B and %2F, but then there's likely going to be some we miss and break in other ways. My vote would be to proceed with this and let users report issues of their use cases that don't work. |
Funnily enough after using the Azure Portal myself I was just about to reply with the same thing! I hope you don't mind me pushing a small refactor to use |
Awesome, thanks. It appears that your latest commit removes the unit tests though. I think it would be valuable to keep those to ensure compatibility, adding test cases in the future if needed. The extension method could just simply delegate to |
In theory I think that those unit tests would realistically only be testing the behaviour of I am working to add some unit tests that cover the logic applied to the handler inputs. |
As long as those handler unit tests cover these key scenarios, I'm good with that. |
If you're happy for those unit tests to be covered by #45 then I think that we can go ahead and merge this. |
Describe the change
The App Config SDK sends i.e. feature flag keys as URL-encoded, even though their API also supports them being not URL-encoded. This URL-decodes them to match the behavior of live Azure App Config.
Current behavior
The app treats kv URLs like
/kv/.appconfig.featureflag%2FMyFlag
and/kv/.appconfig.featureflag/MyFlag
as two distinct keys, i.e. creating a key with the%2F
if encoded that way.New behavior
The app treats the two URLs as equivalent, as Azure App Config does.
Additional context
N/A