From: georggi Date: Sun, 3 Jan 2016 12:00:35 +0000 (+0200) Subject: Import: Handle uploads with sha1 starting with 0 properly X-Git-Tag: 1.31.0-rc.0~8466^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/modifier.php?a=commitdiff_plain;h=37df7263944f0e3f0daa2e49318e7eef63133106;p=lhc%2Fweb%2Fwiklou.git Import: Handle uploads with sha1 starting with 0 properly Bug: T65010 Change-Id: Ia3f2d0b02a0f60df88f9466b66f1c7f5dc870c10 --- diff --git a/includes/import/WikiRevision.php b/includes/import/WikiRevision.php index 9b8c74c878..6c238cf9f2 100644 --- a/includes/import/WikiRevision.php +++ b/includes/import/WikiRevision.php @@ -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 );