Opened 16 years ago

Closed 13 years ago

#978 closed enhancement (fixed)

Unzipped files never inherit file type specified during upload

Reported by: base Owned by: everyone
Priority: minor Milestone: BASE 3.0
Component: coreplugins Version:
Keywords: Cc:

Description

There should perhaps be an option to unpack an uploaded zip file whereby all the files are given the same file type as specified during the upload. At the moment (2.6.2pre) they are all of type -none-. Unless I have missed something...

I acknowledge that people may also want to upload mixed zip files where BASE cannot know which type each file should be.

I also realise that file type is never critical, but the requested functionality would be appreciated all the same.

thanks, Bob

Change History (5)

comment:1 by Nicklas Nordborg, 16 years ago

Unfortunately this is an "unfixable" defect. The API for unpacking files is a kind of plug-in interface (FileUnpacker) that has been made public. The "mistake" is that the API doesn't include any information from the file upload dialog except the directory to upload to (not even the filename is included). Introducing new method or parameters will break the API and we prefer to not do that.

As a workaround to this problem the extension of each file is checked against the list of MIME types (Administrate -> Types -> Mime Types). If a MIME type with the same extension is found and has been connected to a file type, this file type is transferred to the file. This will obviously only work for non-generic file extensions. Eg. .gpr for Genepix raw data files, .cel for Affymetrix CEL files, etc.

Here is a note to the developers. This problem can maybe be fixed by introducing a second interface, EnhancedFileUnpacker. This interface could add methods such as setName(), setFileType(), and more... Whenever a FileUnpacker is used we could also check:

FileUnpacker fu = ...
if (fu instanceof EnhancedFileUnpacker)
{
   EnhancedFileUnpacker efu = (EnhancedFileUnpacker)fu;
   efu.setName(...);
   ....
}

It is not a perfect solution. For example, what if the new interface is not enough? Do we introduce a third one, SuperEnhancedFileUnpacker?

comment:2 by Jari Häkkinen, 16 years ago

Resolution: wontfix
Status: newclosed

comment:3 by Jari Häkkinen, 15 years ago

Milestone: BASE 3.0
Resolution: wontfix
Status: closedreopened

Reopening this ticket and adding to the BASE 3.0 milestone for archival purposes.

comment:4 by Nicklas Nordborg, 13 years ago

Milestone: BASE Future ReleaseBASE 3.0
Type: defectenhancement

comment:5 by Nicklas Nordborg, 13 years ago

Resolution: fixed
Status: reopenedclosed

(In [5758]) Fixes #978: Unzipped files never inherit file type specified during upload

Added a parameter for specifying the source file to FileUnpacker.unpack(). The source file is always populated with the options from the form so the actual implementations can copy those values to the unpacked files.

Note: See TracTickets for help on using tickets.