r32271 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32270‎ | r32271 | r32272 >
Date:23:04, 20 March 2008
Author:brion
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/filerepo/LocalRepo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/LocalRepo.php
@@ -49,12 +49,11 @@
5050 array( 'fa_storage_group' => 'deleted', 'fa_storage_key' => $key ),
5151 __METHOD__, array( 'FOR UPDATE' ) );
5252 if( !$inuse ) {
53 - $sha1 = substr( $key, 0, strcspn($key,'.') );
54 - $ext = substr( $key, strcspn($key,'.') );
 53+ $sha1 = substr( $key, 0, strcspn( $key, '.' ) );
5554 $inuse = $dbw->selectField( 'oldimage', '1',
56 - array( 'oi_sha1' => $sha1, "oi_archive_name LIKE '%{$ext}'",
57 - 'oi_deleted & '.File::DELETED_FILE => File::DELETED_FILE ),
58 - __METHOD__, array( 'FOR UPDATE' ) );
 55+ array( 'oi_sha1' => $sha1,
 56+ 'oi_deleted & '.File::DELETED_FILE => File::DELETED_FILE ),
 57+ __METHOD__, array( 'FOR UPDATE' ) );
5958 }
6059 if ( !$inuse ) {
6160 wfDebug( __METHOD__ . ": deleting $key\n" );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r32267Check extension of key too, for the off chance of collisionsaaron22:18, 20 March 2008

Status & tagging log