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: 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

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>

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

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