This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new e75b643aa8 Fix BZ 66388 - correct regression in removal of URL 
constructors
e75b643aa8 is described below

commit e75b643aa8d94aa8e467be204747a5ec0de11c6a
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
---
 .../apache/catalina/webresources/AbstractArchiveResource.java  |  5 ++++-
 webapps/docs/changelog.xml                                     | 10 ++++++++++
 2 files changed, 14 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 b4f9a3afd6..acba8b8f2e 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,16 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 10.1.5 (markt)" rtext="in development">
+  <subsection name="Catalina">
+    <changelog>
+      <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>
 </section>
 <section name="Tomcat 10.1.4 (markt)" rtext="2022-12-09">
   <subsection name="Other">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to