From 58c7042e708172b8e2fe252fc53abe87bcf8c1f1 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 22 Jan 2014 17:17:58 +0100 Subject: Added error message for when target folder was removed Whent trying to upload/rename/create files in a folder that was removed or rename, the correct error message is now shown. In the case of upload of multiple files, the upload is cancelled. This situation can happen if the target folder was renamed or removed from another browser window or client. --- apps/files/ajax/newfile.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'apps/files/ajax/newfile.php') diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php index ec5b716fb2a..1853098c507 100644 --- a/apps/files/ajax/newfile.php +++ b/apps/files/ajax/newfile.php @@ -64,6 +64,15 @@ if(strpos($filename, '/') !== false) { exit(); } +if (!\OC\Files\Filesystem::file_exists($dir . '/')) { + $result['data'] = array('message' => (string)$l10n->t( + 'The target folder has been moved or deleted.'), + 'code' => 'targetnotfound' + ); + OCP\JSON::error($result); + exit(); +} + //TODO why is stripslashes used on foldername in newfolder.php but not here? $target = $dir.'/'.$filename; -- cgit v1.2.3