Polymer: rootPath is incorrect if URL includes queryParameters or fragment with slash

Created on 1 Sep 2017  路  3Comments  路  Source: Polymer/polymer

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/".

https://github.com/Polymer/polymer/blob/1a32f4dd423116c5d1ee13e452922839d4eebd60/lib/utils/resolve-url.html#L90

bug p3 wontfix

Most helpful comment

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.

All 3 comments

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 (-).

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.

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.

Was this page helpful?
0 / 5 - 0 ratings