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

rootPath is incorrect if URL includes queryParameters or fragment with slash #4822

Closed
jimmc opened this issue Sep 1, 2017 · 4 comments
Closed

Comments

@jimmc
Copy link

jimmc commented Sep 1, 2017

This line needs to strip off the query parameters and fragment identifier before looking for the final slash. If my page location is "http://localhost:8081/files?foo=abc/def", the existing code sets rootPath to "http://localhost:8081/files?foo=abc/", but it should be "http://localhost:8081/".

return url.substring(0, url.lastIndexOf('/') + 1);

@masonlouchart
Copy link

IMHO, the URL http://localhost:8181/files?foo=abc/def has not a valid syntax. The query parameter foo=abc/def contains a path delimiter. If you need to pass a list the delimiter is semicolon (;) else if you have access to the back-end that implements the REST API you can replace the slash by a dash (-).

@jimmc
Copy link
Author

jimmc commented Sep 6, 2017

A little defensive programming to behave better in this situation would be nice. Either ignoring invalid data or raising an explicit error would be better than silently passing along invalid results until they cause a problem much later that then needs to be traced back.

@stale
Copy link

stale bot commented Mar 13, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Mar 13, 2020
@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically closed after being marked stale. If you're still facing this problem with the above solution, please comment and we'll reopen!

@stale stale bot closed this as completed Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants