Page MenuHomePhabricator

certain file types are blocked for uploading
Closed, ResolvedPublic


Author: floeff

The relevant parts of my LocalSettings.php read as follows:

$wgEnableUploads = true;
$wgUploadSizeWarning = 0;
$wgMaxUploadSize = 33554432;
$wgUseAjax = true;
$wgCheckFileExtensions = false;
$wgStrictFileExtensions = false;
$wgVerifyMimeType = false;

Although this should allow uploading of all file types, I cannot upload PDF or ODF documents with this configuration. After choosing them in Firefox 3.6 as upload, nothing happens, the input box stays empty, no error message.

I have to explicitly add

$wgFileExtensions[] = 'pdf';
$wgFileExtensions[] = 'odt';
$wgFileExtensions[] = 'ods';
$wgFileExtensions[] = 'odp';

so it works. Looks like a bug to me.

Version: 1.16.x
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:05 PM
bzimport set Reference to bz24731.
bzimport added a subscriber: Unknown Object (MLST).

odt, ods and odp could be hitting the zip blacklist. There shouldn't be such problem for pdfs, though.

(and as you probably know, doing it this way is insecure)

floeff wrote:

PDFs don't work either. However, I thought with my above settings, the blacklist should be out of effect?

"Files with these mime types will never be allowed as uploads if $wgVerifyMimeType is enabled."
"Files with these extensions will never be allowed as uploads if $wgCheckFileExtensions is set to true."

As VerifyMimeType is set to false, and CheckFileExtensions is set to false, no blacklist should be in effect?

If I remember correctly, the ZIP checks can't be disabled without changing the code.

floeff wrote:

Then it should be documented in the wiki, I guess. However, it doesn't explain why PDF doesn't work.

florian.dufour wrote:

Seems to be related to bug #23583 (/skins/common/upload.js does not consider wgCheckFileExtensions)

Does it upload with javascript disabled in the browser?

floeff wrote:

Indeed, it does. Just tried to upload ODF (OpenDocument Formula). With JS enabled in FF 3.6, upload doesn't work, with disabled JS it works like a charm.

Resolving as dupe of bug 23583 rather than a dependency.

  • This bug has been marked as a duplicate of bug 23583 ***
Gilles raised the priority of this task from Medium to Unbreak Now!.Dec 4 2014, 10:29 AM
Gilles moved this task from Untriaged to Done on the Multimedia board.
Gilles lowered the priority of this task from Unbreak Now! to Medium.Dec 4 2014, 11:22 AM