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

rmaucher 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 220b131ce0 Handle InvalidFileNameException when parsing parts
220b131ce0 is described below

commit 220b131ce0dea7bba6c01e37e7398aac30dc1008
Author: remm <[email protected]>
AuthorDate: Tue Jul 14 19:45:48 2026 +0200

    Handle InvalidFileNameException when parsing parts
    
    Rethrow it as an IllegalStateException as mandated by the Servlet
    specification.
    BZ70143
---
 java/org/apache/catalina/connector/Request.java | 4 ++--
 webapps/docs/changelog.xml                      | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/connector/Request.java 
b/java/org/apache/catalina/connector/Request.java
index b27234142f..e3b855456f 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -110,7 +110,7 @@ import org.apache.tomcat.util.http.ServerCookie;
 import org.apache.tomcat.util.http.ServerCookies;
 import org.apache.tomcat.util.http.fileupload.FileItem;
 import org.apache.tomcat.util.http.fileupload.FileUpload;
-import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory;
+import org.apache.tomcat.util.http.fileupload.InvalidFileNameException;import 
org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory;
 import 
org.apache.tomcat.util.http.fileupload.impl.FileCountLimitExceededException;
 import org.apache.tomcat.util.http.fileupload.impl.InvalidContentTypeException;
 import org.apache.tomcat.util.http.fileupload.impl.SizeException;
@@ -2796,7 +2796,7 @@ public class Request implements HttpServletRequest {
                 }
 
                 success = true;
-            } catch (InvalidContentTypeException e) {
+            } catch (InvalidContentTypeException | InvalidFileNameException e) 
{
                 
parameters.setParseFailedReason(FailReason.INVALID_CONTENT_TYPE);
                 partsParseException = new ServletException(e);
             } catch (SizeException | FileCountLimitExceededException e) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 13809502f7..f8a2117b2f 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -127,6 +127,11 @@
         <code>DataSourceUserDatabase</code> fails and improve error reporting.
         (remm)
       </fix>
+      <fix>
+        <bug>70143</bug>: Handle InvalidFileNameException when parsing parts to
+        rethrow it as an <code>IllegalStateException</code> as mandated by the
+        Servlet specification. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


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

Reply via email to