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 5dfe09786f Handle InvalidFileNameException when parsing parts
5dfe09786f is described below

commit 5dfe09786fab62ceacebdc5498c942c490ccb6de
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 e89cfce924..a9c6d761d4 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;
@@ -2837,7 +2837,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 f4544db830..ebd458b300 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