Skip to content

Issue 46962: Fix decoding of paths containing encoded commas #140

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

Merged
merged 6 commits into from
Dec 19, 2022

Conversation

labkey-susanh
Copy link
Contributor

Rationale

decodeURI chooses not to decode encoded commas (presumably because encodeURI also does nothing with commas) (even though decodeURIComponent does the right thing). This can be problematic since encoding of commas is actually recommended (and done on the server side).

Related Pull Requests

Changes

  • Add own decodeURI method to handle decoding of commas as well.

@@ -273,6 +273,16 @@ export interface ActionPath {
controller: string;
}

/**
* decodeURI chooses not to decode encoded commas (presumably because encodeURI also does nothing with commas).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why:

image

So should we consider any of these other characters? Also, just curious, where did you see that it is recommended to encode them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for that pointer. I think in this usage, since we've already identified the part that's being decoded as a container path, which shouldn't include parts where these characters have meaning in the URI syntax, it should be safe to decode all of these characters (so they don't get double encoded later). Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, but we prevent the use of many of these characters in folder names. We allow ;, @, &, =, $, ,, and #. Perhaps we should expand the set of not allowed characters, but there may be some weird ones in the wild already.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@labkey-nicka I've update the method to decode the other characters that are valid in project names but encoded by URI encoding. I believe returning the fully decoded path is what we want here since previously that is what was expected, just not being done. Happy to discuss, though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what you've done works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants