From 9bce95e007ff66a689a9028db98db84511a06b83 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 6 Jul 2007 21:50:43 +0000 Subject: [PATCH] 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. --- includes/filerepo/FSRepo.php | 5 +++++ 1 file changed, 5 insertions(+) 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 ); -- 2.20.1