[MAGNOLIA-285] Uploading multiple files with the same filename causes exception Created: 06/Feb/05  Updated: 24/Oct/12  Resolved: 24/Oct/12

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 2.01, 3.0 RC4
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Andreas Weder Assignee: Philipp Bärfuss
Resolution: Outdated Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Tested on Mac OS X, Linux and Windows and with multiple browsers.


Issue Links:
duplicate
is duplicated by MAGNOLIA-1064 In Dialog with 2 File Upload Controls... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

I have a paragraph, which allows me to upload multiple images, and another one for multiple files.

If at least two files have the same file name, I get the following exception:

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
info.magnolia.cms.Filter.MultipartRequestFilter.doFilter(MultipartRequestFilter.java:76)
info.magnolia.cms.Filter.ContentTypeFilter.doFilter(ContentTypeFilter.java:52)

root cause

java.lang.NullPointerException
info.magnolia.cms.beans.runtime.Document.delete(Document.java:153)
info.magnolia.cms.gui.control.Save.save(Save.java:242)
org.apache.jsp.admintemplates.dialogs.standard_jsp._jspService(standard_jsp.java:103)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
info.magnolia.cms.Filter.MultipartRequestFilter.doFilter(MultipartRequestFilter.java:76)
info.magnolia.cms.Filter.ContentTypeFilter.doFilter(ContentTypeFilter.java:52)

Workaround:
Upload the files with the same file name sequentally.



 Comments   
Comment by Philipp Bracher [ 16/May/06 ]

not so important

Comment by Jan Haderka [ 08/Aug/08 ]

failed to reproduce with 3.6.1

Comment by Jan Haderka [ 22/Sep/08 ]

The source of the issue is the fact that multipart filter (or the underlying code to deal with multipart request data) saves temp files with the exactly same names as they come in multipart form which (if the timing is right) results in file being either overridden, corrupted or deleted. This could be potentially more disastrous when two users tried to upload file with same name but different content at a same time.

Comment by Andreas Weder [ 24/Oct/12 ]

I'm closing this... too many things have changed in the mean time.

Generated at Mon Feb 12 03:15:55 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.