Merge "Import: Handle uploads with sha1 starting with 0 properly"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 3 Jan 2016 13:21:50 +0000 (13:21 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 3 Jan 2016 13:21:50 +0000 (13:21 +0000)
includes/import/WikiRevision.php

index 9b8c74c..6c238cf 100644 (file)
@@ -613,8 +613,9 @@ class WikiRevision {
                        wfDebug( __METHOD__ . ": Could not fetch remote file.\n" );
                        return false;
                }
+               $sha1File = ltrim( sha1_file( $source ), '0' );
                $sha1 = $this->getSha1();
-               if ( $sha1 && ( $sha1 !== sha1_file( $source ) ) ) {
+               if ( $sha1 && ( $sha1 !== $sha1File ) ) {
                        if ( $flags & File::DELETE_SOURCE ) {
                                # Broken file; delete it if it is a temporary file
                                unlink( $source );