From: Tim Starling Date: Fri, 6 Jul 2007 21:50:43 +0000 (+0000) Subject: Don't move the destination to the archive until we have checked that the source file... X-Git-Tag: 1.31.0-rc.0~52239 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=9bce95e007ff66a689a9028db98db84511a06b83;p=lhc%2Fweb%2Fwiklou.git Don't move the destination to the archive until we have checked that the source file exists. This was causing some data "misplacement" on double-submission of the upload warning confirmation form. --- diff --git a/includes/filerepo/FSRepo.php b/includes/filerepo/FSRepo.php index a75ba7ac6e..dc404447f1 100644 --- a/includes/filerepo/FSRepo.php +++ b/includes/filerepo/FSRepo.php @@ -214,6 +214,11 @@ class FSRepo extends FileRepo { $dstDir = dirname( $dstPath ); if ( !is_dir( $dstDir ) ) wfMkdirParents( $dstDir ); + // Check if the source is missing before we attempt to move the dest to archive + if ( !is_file( $srcPath ) ) { + return new WikiErrorMsg( 'filenotfound', wfEscapeWikiText( $srcPath ) ); + } + if( is_file( $dstPath ) ) { $archiveDir = dirname( $archivePath ); if ( !is_dir( $archiveDir ) ) wfMkdirParents( $archiveDir );