jijo-paulose / gwtupload

Automatically exported from code.google.com/p/gwtupload
Other
0 stars 0 forks source link

All files get deleted on exception #217

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use the UploadAction servlet version 1.0.1
2. Set context parameter:
    <context-param>
        <!-- max size of the upload request -->
        <param-name>maxSize</param-name>
        <param-value>3145728</param-value>
    </context-param>

3. Create a MultiUploader like this:
        MultiUploader uploader = new MultiUploader(IFileInput.FileInputType.ANCHOR);
        uploader.getWidget().setStyleName("uploadBrowse");
        uploader.setMultipleSelection(false);
        uploader.setI18Constants(TextResourceProvider.getConstants());
        uploader.setAvoidRepeatFiles(false);
        uploader.setMaximumFiles(10);
        uploader.setValidExtensions("jpg", "jpeg", "png", "pdf");

4. Upload 1 file below the filesize limit (FILE_1)
5. Upload 1 file above the filesize limit (FILE_2)

What is the expected output? What do you see instead?
I would expect the the error of file (FILE_2) being to big. And then being able 
to continue using the application with file (FILE_1) still uploaded.

But the file (FILE_1) gets deleted!

What version of the product are you using? On what operating system?
version 1.0.1 on windows and linux

Please provide any additional information below.

The problem is that:
The doPost method calls super.parsePostRequest which calls 
this.checkRequest(request) which check the filesize limit.
When the limit is to big an UploadSizeLimitException is thrown.
This exception is rethrown until it hits the catch back in UploadAction.
This effectively sets the error variable to a non-null value.
Later if the error is not null an XMLResponse is rendered AND 
UploadServlet.removeSessionFileItems(request); is called which effectively 
deletes ALL files from storage.

This is wrong! Why delete perfectly "legal" files?

Original issue reported on code.google.com by renemark...@gmail.com on 8 May 2015 at 1:06