You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decoding successfully extracted path parameters sometimes fails with an IllegalArgumentException / URISyntaxException. This happens for path segments containing special characters, brackets in my case.
java.lang.IllegalArgumentException: Illegal character in path at index 7: foo/bar[1].png
at java.base/java.net.URI.create(URI.java:883)
at ninja.utils.AbstractContext.getPathParameter(AbstractContext.java:195)
at ninja.params.ArgumentExtractors$PathParamExtractor.extract(ArgumentExtractors.java:133)
at ninja.params.ArgumentExtractors$PathParamExtractor.extract(ArgumentExtractors.java:124)
at ninja.params.ControllerMethodInvoker.invoke(ControllerMethodInvoker.java:70)
...
Caused by: java.net.URISyntaxException: Illegal character in path at index 7: foo/bar[1].png
at java.base/java.net.URI$Parser.fail(URI.java:2913)
at java.base/java.net.URI$Parser.checkChars(URI.java:3084)
at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3166)
at java.base/java.net.URI$Parser.parse(URI.java:3125)
at java.base/java.net.URI.<init>(URI.java:600)
at java.base/java.net.URI.create(URI.java:881)
... 50 more
To decode a path parameter, Ninja uses the URI class. This class does not accept literal brackets, hence the exception. Browsers, however, don't convert brackets in the path, while other special characters are sent encoded. Seems there is a discrepancy what characters are allowed in a URL.
What do you think about using a path parameter decoder that is less strict and accepts all special characters that are sent literally by browsers? Thanks!
The text was updated successfully, but these errors were encountered:
Decoding successfully extracted path parameters sometimes fails with an IllegalArgumentException / URISyntaxException. This happens for path segments containing special characters, brackets in my case.
To decode a path parameter, Ninja uses the
URI
class. This class does not accept literal brackets, hence the exception. Browsers, however, don't convert brackets in the path, while other special characters are sent encoded. Seems there is a discrepancy what characters are allowed in a URL.What do you think about using a path parameter decoder that is less strict and accepts all special characters that are sent literally by browsers? Thanks!
The text was updated successfully, but these errors were encountered: