From: Brion Vibber Date: Thu, 20 Mar 2008 23:04:41 +0000 (+0000) Subject: Revert r32267 (require match of file extension when doing SHA-1 file lookups). X-Git-Tag: 1.31.0-rc.0~48909 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=60ac0d114c26370fd4cdbe51ec6cff3e967d0312;p=lhc%2Fweb%2Fwiklou.git Revert r32267 (require match of file extension when doing SHA-1 file lookups). This would fail to match files which have legitimate variations of an extension (case, aliases -- .JPG vs .jpeg etc) Would also fail to match files which can't be type-checked reliably so might be uploaded under multiple different extensions without impediment. --- diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index 9377b56b2a..8a8bba2df3 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -49,12 +49,11 @@ class LocalRepo extends FSRepo { array( 'fa_storage_group' => 'deleted', 'fa_storage_key' => $key ), __METHOD__, array( 'FOR UPDATE' ) ); if( !$inuse ) { - $sha1 = substr( $key, 0, strcspn($key,'.') ); - $ext = substr( $key, strcspn($key,'.') ); + $sha1 = substr( $key, 0, strcspn( $key, '.' ) ); $inuse = $dbw->selectField( 'oldimage', '1', - array( 'oi_sha1' => $sha1, "oi_archive_name LIKE '%{$ext}'", - 'oi_deleted & '.File::DELETED_FILE => File::DELETED_FILE ), - __METHOD__, array( 'FOR UPDATE' ) ); + array( 'oi_sha1' => $sha1, + 'oi_deleted & '.File::DELETED_FILE => File::DELETED_FILE ), + __METHOD__, array( 'FOR UPDATE' ) ); } if ( !$inuse ) { wfDebug( __METHOD__ . ": deleting $key\n" );