This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new cf2015c135 Fix BZ 66388 - correct regression in removal of URL constructors cf2015c135 is described below commit cf2015c1350a3f057182dd4c26c20f68df8b3400 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Dec 14 18:21:35 2022 +0000 Fix BZ 66388 - correct regression in removal of URL constructors --- java/org/apache/catalina/webresources/AbstractArchiveResource.java | 5 ++++- webapps/docs/changelog.xml | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/webresources/AbstractArchiveResource.java b/java/org/apache/catalina/webresources/AbstractArchiveResource.java index 534a3db429..8e4daffddc 100644 --- a/java/org/apache/catalina/webresources/AbstractArchiveResource.java +++ b/java/org/apache/catalina/webresources/AbstractArchiveResource.java @@ -22,11 +22,14 @@ import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.security.cert.Certificate; import java.util.concurrent.atomic.AtomicBoolean; import java.util.jar.JarEntry; import java.util.jar.Manifest; +import org.apache.catalina.util.URLEncoder; + public abstract class AbstractArchiveResource extends AbstractResource { private final AbstractArchiveResourceSet archiveResourceSet; @@ -139,7 +142,7 @@ public abstract class AbstractArchiveResource extends AbstractResource { @Override public URL getURL() { - String url = baseUrl + resource.getName(); + String url = baseUrl + URLEncoder.DEFAULT.encode(resource.getName(), StandardCharsets.UTF_8); try { return new URI(url).toURL(); } catch (MalformedURLException | URISyntaxException e) { diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index b467321395..a5594a135f 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -117,6 +117,12 @@ correct <code>protocolHeader</code> default value of "X-Forwarded-Proto". (lihan) </fix> + <fix> + <bug>66388</bug>: Correct a regression in the refactoring that replaced + the use of the <code>URL</code> constructors. The regression broke + lookups for resources that contained one or more characters in their + name that required escaping when used in a URI path. (markt) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org