Page MenuHomePhabricator

Add 'no-change' and 'duplicate-of-old-version' warnings for uploading files
Closed, ResolvedPublic

Description

Currently there is a warning message if a file already exists, but there is no warning that no change would be made to the file, or if it identical to an older version.

Warnings such as 'no-change' and 'duplicate-of-old-version' would be more specific than just 'exists' and would allow api users to make more informed decisions about whether they want to replace the current file, since they will know they aren't uploading the same exact file multiple times and cluttering the file's history, without needing to check md5s or similar in each bot script they write that uploads files.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 1 2016, 10:29 PM
Restricted Application added a project: Multimedia. · View Herald TranscriptAug 2 2016, 12:57 AM
Restricted Application added a project: Commons. · View Herald TranscriptAug 2 2016, 12:57 AM
Restricted Application added a subscriber: Matanya. · View Herald Transcript

Change 306336 had a related patch set uploaded (by Matthias Mullie):
Add API warnings when upload is same as older versions

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

Restricted Application added a subscriber: Poyekhali. · View Herald TranscriptAug 24 2016, 7:34 AM
matthiasmullie moved this task from Untriaged to Needs code review on the Multimedia board.

Example API results with the patch:

{
    "upload": {
        "result": "Warning",
        "warnings": {
            "exists": "Multiple_versions_test.png",
            "nochange": {
                "timestamp": "2016-09-06T18:38:40Z"
            },
            "duplicateversions": [
                {
                    "timestamp": "2016-09-01T21:49:54Z"
                },
                {
                    "timestamp": "2016-09-01T20:40:29Z"
                }
            ]
        },
        "filekey": "14ak4j8g8hz8.xj2gvk.1.png",
        "sessionkey": "14ak4j8g8hz8.xj2gvk.1.png"
    }
}
<?xml version="1.0"?>
<api>
  <upload result="Warning" filekey="14ak55gst46w.rf98sl.1.png" sessionkey="14ak55gst46w.rf98sl.1.png">
    <warnings exists="Multiple_versions_test.png">
      <nochange timestamp="2016-09-06T18:38:40Z" />
      <duplicateversions>
        <ver timestamp="2016-09-01T21:49:54Z" />
        <ver timestamp="2016-09-01T20:40:29Z" />
      </duplicateversions>
    </warnings>
  </upload>
</api>
matmarex closed this task as Resolved.Sep 6 2016, 6:48 PM
matmarex removed a project: Patch-For-Review.

Change 306336 merged by jenkins-bot:
Add API warnings when upload is same as older versions

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