Page MenuHomePhabricator

Initial duplicate check is broken in Firefox, Chrome (not Opera)
Closed, ResolvedPublic

Description

The sha-1 based duplicate check which should return a friendly "This file was previously uploaded" message on the first step is no longer working in (recent) Firefox/Chrome versions. It's still working in Opera, oddly enough.

The upload will still be rejected with at least a human-readable error message in the final step.


Version: unspecified
Severity: normal

Details

Reference
bz37108

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:22 AM
bzimport set Reference to bz37108.

The reason it's working in Opera is because ApiUploadHandler doesn't set the ignorewarnings field, and we just made sure it would use that in a recent bug fix. Apparently, when ignorewarnings is set, the hash check is either not performed or not reported for some reason.

So, we could either unset ignorewarnings for FormDataTransport browsers, or we could set ignorewarnings for ApiUploadHandler browsers. In the former case, we lose some of the flexibility for title-related errors, which could be fixed in the Details step of UW. In the latter case, we lose any capacity to act on the hash check in the first step, but at least we're consistent.

The third option is to debug core and figure out why the hash check isn't performed when ignorewarnings is set and the duplicate filename error is already present (try renaming a file you've uploaded before, chrome and firefox will complain then). I'll start into this now, because both of the above options have major drawbacks.

Ha! Got it.

FormDataTransport wasn't using the same trick as the HTML form, adding the timestamp to the filename to avoid duplicate warnings. The server will only return 'duplicate' if there are both, so avoiding the harmless one is important on the first step.

Patch. Patch need review. Patch here: https://gerrit.wikimedia.org/r/8937

Gilles raised the priority of this task from Medium to Unbreak Now!.Dec 4 2014, 10:27 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:23 AM