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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 475d207d8e Avoid double decoding
475d207d8e is described below

commit 475d207d8eb6c7c82465a02ec6cc431fead85f03
Author: remm <[email protected]>
AuthorDate: Wed May 27 09:45:30 2026 +0200

    Avoid double decoding
    
    Also I'm not sure why this has the inconsistent static reference to
    UTF-8.
---
 java/org/apache/tomcat/util/descriptor/web/FilterMap.java          | 2 +-
 java/org/apache/tomcat/util/descriptor/web/SecurityCollection.java | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/tomcat/util/descriptor/web/FilterMap.java 
b/java/org/apache/tomcat/util/descriptor/web/FilterMap.java
index 7e15683099..14851bd196 100644
--- a/java/org/apache/tomcat/util/descriptor/web/FilterMap.java
+++ b/java/org/apache/tomcat/util/descriptor/web/FilterMap.java
@@ -202,7 +202,7 @@ public class FilterMap extends XmlEncodingBase implements 
Serializable {
         } else {
             String[] results = new String[urlPatterns.length + 1];
             System.arraycopy(urlPatterns, 0, results, 0, urlPatterns.length);
-            results[urlPatterns.length] = UDecoder.URLDecode(urlPattern, 
getCharset());
+            results[urlPatterns.length] = urlPattern;
             urlPatterns = results;
         }
     }
diff --git a/java/org/apache/tomcat/util/descriptor/web/SecurityCollection.java 
b/java/org/apache/tomcat/util/descriptor/web/SecurityCollection.java
index c182aa2ced..abe60162d3 100644
--- a/java/org/apache/tomcat/util/descriptor/web/SecurityCollection.java
+++ b/java/org/apache/tomcat/util/descriptor/web/SecurityCollection.java
@@ -17,7 +17,6 @@
 package org.apache.tomcat.util.descriptor.web;
 
 import java.io.Serializable;
-import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 
 import org.apache.tomcat.util.buf.UDecoder;
@@ -203,7 +202,7 @@ public class SecurityCollection extends XmlEncodingBase 
implements Serializable
      * @param pattern The pattern
      */
     public void addPattern(String pattern) {
-        addPatternDecoded(UDecoder.URLDecode(pattern, StandardCharsets.UTF_8));
+        addPatternDecoded(UDecoder.URLDecode(pattern, getCharset()));
     }
 
     /**
@@ -217,9 +216,8 @@ public class SecurityCollection extends XmlEncodingBase 
implements Serializable
             return;
         }
 
-        String decodedPattern = UDecoder.URLDecode(pattern, getCharset());
         String[] results = Arrays.copyOf(patterns, patterns.length + 1);
-        results[patterns.length] = decodedPattern;
+        results[patterns.length] = pattern;
         patterns = results;
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to