This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new a2eeb2e05e Handle InvalidFileNameException when parsing parts
a2eeb2e05e is described below
commit a2eeb2e05ed751285a6fcfed4c9e9dba3ef4aa04
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 | 3 ++-
webapps/docs/changelog.xml | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/catalina/connector/Request.java
b/java/org/apache/catalina/connector/Request.java
index e31540b352..b563b1bc7d 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -108,6 +108,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.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;
@@ -2587,7 +2588,7 @@ public class Request implements HttpServletRequest {
parts.add(part);
}
success = true;
- } catch (InvalidContentTypeException e) {
+ } catch (InvalidContentTypeException | InvalidFileNameException e) {
partsParseException = new ServletException(e);
} catch (SizeException | FileCountLimitExceededException e) {
checkSwallowInput();
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 54bceec742..0c0bb4ec3d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -248,6 +248,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]