PKP Bugzilla – Bug 6648
QuickSubmit plugin galley files have incorrect type
Last modified: 2011-05-19 17:01:24 PDT
It seems that the temporary file manager is not getting a correct file type for each file -- I've uploaded several different PDFs and all have an application/x-octet-stream file type.
I suspect it's either a weird PDF or a local misconfiguration, Matt, since you're getting a valid MIME type. Check String::mime_content_type to see which case it's using, and alter your config to suit.
The temporary file manager upload methods do not seem to get the file type by calling String::mime_content_type() -- It sets it directly from the $_FILES superglobal (see PKPTemporaryFileManager::handleUpload()). So, though there may be a problem with my upload (not sure if its the PDF or more likely just my server setup), the mime_content_type function is able to deal with that and correctly labels PDFs as PDFs when used (e.g. when uploading a PDF galley to a submission through the main submission workflow). So I think temporary files need to set their filetype by calling FileManager::getUploadedFileType() -- But I made that change and couldn't get it to work, i guess because some sort of sandboxing by PHP of temporary files?
I'll defer to the results of further testing -- but if possible, the QuickSubmit plugin should be changed to use the same method for detecting MIME types as the standard submission process.
Alec, can you vet this fix, and let me know if you'd like it in the 2.3.5 release?
Matt, looks fine at a glance -- please go ahead, if you've tested it.
Created attachment 3510 [details]
Patch against pkp-lib in OJS pre-2.3.5
Note to users applying this patch: It must be applied from the lib/pkp/ subdirectory.
Committed to stable and HEAD.