Page MenuHomePhabricator

UploadWizard does not handle invalid names
Closed, ResolvedPublic

Description

Steps to reproduce:

  1. go to file step
  2. upload a file with no extension

Expected result: error message about file name, or (preferably) auto-correct
Actual result: no visible effect, JS error about this.title being null on mw.UploadWizardUpload.js line 446

Event Timeline

Tgr raised the priority of this task from to Needs Triage.
Tgr updated the task description. (Show Details)
Tgr added a project: UploadWizard.
Tgr subscribed.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Files without an extension are perfectly valid in some operating systems.

I actually can't repro on master with a JPG lacking an extension (OS X/firefox). It uploads fine and UW seems to add the extension in the UI.

Maybe in your case it's the combination of unsupported MIME type and lack of extension? What kind of file were you uploading?

Attached the test file I was using (with master). It's the one generated by the chunked upload browser test.

1x1 (1×1 px, 97 KB)

Invisible pixel is invisible... F42903

Can you upload it somewhere else? I can't find a way to download and save the actual image in phabricator, I keep getting an HTML error served instead.

I did reproduce your issue, however, by picking a text file with no extension.

I can't find a way to download and save the actual image in phabricator, I keep getting an HTML error served instead.

@Gilles: F42903 , "View File", "Save" in your browser? Works in Firefox. Chrome might be broken and invalidate the token by reloading...

Look at what it actually saves, the contents of the file is the HTML of an expired token error page.

@Gilles: Not here, it's a valid PNG with my steps above in FF.

Can either of you just email it to me? :)

Right click on view file and select save. (T87083)

That works, thanks. I think that the issue is what I expected: OS X's mime detection thinks this is a text file. Linux's mime detection probably does the same. Therefore, it behaves like an extension-less text file on upload. I imagine that the way crunchy generates it is throwing off the mime regexps.

So I think that it's smaller bug than expected. Extension-less images that are correctly mime-detected (which would be the vast majority) seem to work fine in UW.

Change 235363 had a related patch set uploaded (by Bartosz Dziewoński):
Correctly report an error for file names without extension

https://gerrit.wikimedia.org/r/235363

Change 235363 merged by jenkins-bot:
Correctly report an error for file names without extension

https://gerrit.wikimedia.org/r/235363