Repository navigation
Do not encode the path again when converting a war: URL to a jar: URL - #1260
Open
arturobernalg wants to merge 1 commit into
Open
arturobernalg wants to merge 1 commit into
arturobernalg wants to merge 1 commit into
Conversation
UriUtil.warToJar() built the jar: URI with the multi-argument URI constructor, which quotes '%'. The path of a war:file: URL is already percent-encoded, so a WAR in a directory with a space produced jar:file:/some%2520dir/app.war!/... and the JARs in WEB-INF/lib of an unpacked=false WAR could not be scanned. Web fragments, TLDs and annotations in those JARs were silently ignored. Use the single argument constructor, as buildJarUrl() already does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes https://bz.apache.org/bugzilla/show_bug.cgi?id=70360
UriUtil.warToJar()builds thejar:URI withnew URI("jar", file, null). The multi-argument URI constructors always quote '%', but the path of awar:file:URL is already percent-encoded, so it is encoded twice:war:file:/some%20dir/app.war*/WEB-INF/lib/a.jarbecomesjar:file:/some%2520dir/app.war!/WEB-INF/lib/a.jar.RFC 3986, section 2.4: "Implementations must not percent-encode or decode the same string more than once". 10.1.x and 9.0.x are not affected, they still use the URL constructor.
The single argument constructor is now used, as
buildJarUrl()already does.Tested on a local Tomcat with
unpackWARs="false"and a WAR whose WEB-INF/lib JAR contains a web-fragment.xml, no Spring Boot involved:.../some dir/appsNoSuchFileException: .../some%20dir/apps/app.war, fragment ignored.../nospace/appsThe new test in TestUriUtil fails without the change.