Skip to content
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

Fix for: Exception occurring when encoding the path containing unwise characters (i.e space) #364

Merged
merged 5 commits into from
Mar 28, 2024

Conversation

lwitkowski
Copy link
Collaborator

Fixes #358

return null;
}
try {
return new URI(context.path.replaceAll(" ", "%20"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question out of curiosity: shouldn't we escape whole path?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure what other options we have? Only path segment after last '/' ?
Even if - is there any harm to keep it simple with replaceAll?

Copy link
Collaborator

Choose a reason for hiding this comment

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

As usual I'm referring to standards ;)

In RFC2396 (URI spec) you can find unwise characters that required escaping.

  unwise      = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`"

Might not be worth doing it in this scenario though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for details @pazkooda, very good idea to properly handle all of them (i.e by using UrlDecoder/Encoder classes), please re-review, unfortunately the changes got bigger as I needed to adjust problem-to-json serializers as well.

Copy link
Collaborator

@pazkooda pazkooda left a comment

Choose a reason for hiding this comment

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

Handling of unwise char will be nice bonus but otherwise look OK.

@lwitkowski lwitkowski changed the title Fix for: Exception occurring when encoding the path containing space Fix for: Exception occurring when encoding the path containing unwise characters (i.e space) Mar 28, 2024
@lwitkowski lwitkowski merged commit dc05920 into master Mar 28, 2024
22 checks passed
@lwitkowski lwitkowski deleted the 358-exception-occurring-when-encoding-the-path branch March 28, 2024 13:47
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.

Exception occurring when encoding the path containing unwise characters (i.e space)
2 participants