Forum OpenACS Development: file-storage in 4.6

Collapse
Posted by Jon Griffin on
Has anyone sucessfully used file-storage?

It seems to break more and more with each revision. I did a clean install and can't upload any files as "insert into cr_mime_types" errors out.

Why are you inserting filenames into the mime_types db? Something is very, very wrong.

Collapse
2: Re: file-storage in 4.6 (response to 1)
Posted by Jamie Rasmussen on
Yes, its very broken. The comment on the cr_mime_types table says, "file_extension is not used to recognize MIME types, but to associate a file extension to the file after its MIME type is specified." Of course, file-storage ignores this, and tries to use file extensions to recognize MIME types. This fails because many file extensions can map to a single MIME type, violating the primary key constraint on mime_type when file-storage tries to add new rows. I.e. "jpg" is already in the table, so uploading a file with extension "jpeg" or "JPG" will fail. It looks like the download package might also include this faulty code.

I'm not sure what the correct solution is. Could you add "*/*" as a MIME type in the cr_mime_types table, and change fs_maybe_create_new_mime_type to just be return [ns_guesstype $file_name]?

Collapse
Posted by Tilmann Singer on
This has already been reported in the sdm and Jeff Davis said on irc he would fix it soon *hinthint*:

http://sdm.openacs.org/sdm/open-bafs.tcl?module_id=82&package_id=9