Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#697 closed defect (fixed)

Uploading and unpacking a compressed file corrupts the file

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: critical Milestone: BASE 2.4
Component: core Version:
Keywords: Cc:

Description

This is the scenario:

  • Upload a zip file to BASE
  • Choose to unpack the file and to keep the compressed file
  • Download the compressed file again and try to open it

With Ark I get the error message:

An error occurred while trying to open the archive

The file sizes of the original file and the uploaded/downloaded file are different. The uploaded/downloaded file is a few bytes smaller (22283 compared to 22315 bytes)

If I just upload and download the zip file without unpacking it doesn't become corrupted.

Change History (4)

comment:1 by Nicklas Nordborg, 17 years ago

Summary: Uploading a compressed file corrupts the fileUploading and unpacking a compressed file corrupts the file

comment:2 by Nicklas Nordborg, 17 years ago

Owner: changed from everyone to Nicklas Nordborg
Status: newassigned

comment:3 by Nicklas Nordborg, 17 years ago

Resolution: fixed
Status: assignedclosed

(In [3606]) Fixes #697: Uploading and unpacking a compressed file corrupts the file

comment:4 by Nicklas Nordborg, 17 years ago

The problem seemed to affect zip files only. It was caused by the ZipInputStream which didn't read the last few bytes (32 in this case) of the file. It probably didn't need to since all file data had been transfered. The last part of the zip file contains some kind of directory listing all files in it.

The solution was to let the InputStreamSplitter copy the remaining part of the file when close() was called. I also had to fix some other problems with it. For example the skip() method didn't copy the bytes. It is now a true/false option if it should do that or not.

I also extended the TestFile test cases to check file sizes against the original file.

Note: See TracTickets for help on using tickets.