Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Throw an error when trying to restore on an existing file. Close #1368
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Dec 11, 2017
1 parent 55b07eb commit 64bd811
Show file tree
Hide file tree
Showing 28 changed files with 79 additions and 9 deletions.
14 changes: 12 additions & 2 deletions core/src/plugins/access.fs/FsAccessDriver.php
Expand Up @@ -1042,8 +1042,18 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
if($selection->isUnique() && isSet($httpVars["targetBaseName"])){
$targetBaseName = $httpVars["targetBaseName"];
}
if(isSet($httpVars["recycle_restore"]) && !file_exists($selection->nodeForPath($destPath)->getUrl())){
$this->mkDir($selection->nodeForPath(PathUtils::forwardSlashDirname($destPath)), basename($destPath), false, true);
if(isSet($httpVars["recycle_restore"])){
$targetPath = rtrim($destPath, "/") . "/" . PathUtils::forwardSlashBasename($selection->getUniqueNode()->getPath());
if(file_exists($selection->nodeForPath($targetPath)->getUrl())){
if(is_file($selection->nodeForPath($targetPath)->getUrl())){
throw new PydioException(sprintf($mess[631], $targetPath));
} else {
throw new PydioException(sprintf($mess[632], $targetPath));
}
}
if(!file_exists($selection->nodeForPath($destPath)->getUrl())){
$this->mkDir($selection->nodeForPath(PathUtils::forwardSlashDirname($destPath)), basename($destPath), false, true);
}
}
$this->filterUserSelectionToHidden($ctx, [$httpVars["dest"]]);
if ($selection->inZip()) {
Expand Down
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/ca.php
Expand Up @@ -731,5 +731,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",

);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/cs.php
Expand Up @@ -728,4 +728,6 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/da.php
Expand Up @@ -733,5 +733,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/de.php
Expand Up @@ -735,6 +735,8 @@
"628" => "Zurücksetzen",
"629" => "Noch keine Einträge",
"630" => "Mit mir geteilte Dateien",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
/* password strength tester */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/en.php
Expand Up @@ -730,4 +730,6 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/es.php
Expand Up @@ -735,4 +735,6 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/et.php
Expand Up @@ -731,5 +731,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/eus.php
Expand Up @@ -729,5 +729,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/fi.php
Expand Up @@ -731,5 +731,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
12 changes: 7 additions & 5 deletions core/src/plugins/core.ajaxplorer/i18n/fr.php
Expand Up @@ -725,10 +725,12 @@
"623" => "Copier",
"624" => "Copié!",
"625" => "Lettre",
"626" => "Files Shared with me",
"627" => "Shares from remote servers",
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"626" => "Fichiers partagés avec moi",
"627" => "Partages de serveurs distants",
"628" => "Revenir",
"629" => "Pas d'enregistrements",
"630" => "Dossiers partagés avec moi",
"631" => "Attention, cette opération va écraser un fichier existant (%s). Veuillez renommer le fichier pour rendre possible la restauration depuis la corbeille.",
"632" => "Attention, cette opération va écraser un répertoire existant (%s). Veuillez renommer le répertoire pour rendre possible la restauration depuis la corbeille.",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/gr.php
Expand Up @@ -728,5 +728,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/he.php
Expand Up @@ -728,5 +728,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/hu.php
Expand Up @@ -733,5 +733,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/it.php
Expand Up @@ -748,5 +748,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/ja.php
Expand Up @@ -733,6 +733,8 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* 文章はここまで */
/* 文章終了 */
);
8 changes: 8 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/kr.php
Expand Up @@ -733,5 +733,13 @@
"628" => "실해 취소",
"629" => "레코드 없음",
"630" => "나와 공유된 파일",
"plugtype.title.cache" => "Cache server",
"plugtype.desc.cache" => "Unique plugin to set up the cache server used by the application",
"plugtype.title.sec" => "Security",
"plugtype.desc.sec" => "Advanced Security Features",
"plugtype.title.helper" => "Helper",
"plugtype.desc.helper" => "Helpers tools for administrative tasks",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/nl.php
Expand Up @@ -734,5 +734,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/no.php
Expand Up @@ -732,5 +732,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/pl.php
Expand Up @@ -728,5 +728,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
4 changes: 3 additions & 1 deletion core/src/plugins/core.ajaxplorer/i18n/pt-br.php
Expand Up @@ -728,6 +728,8 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
/* testador de força de senha */
);
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/pt.php
Expand Up @@ -728,6 +728,8 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
/* password strength tester */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/ru.php
Expand Up @@ -728,6 +728,8 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
/* password strength tester */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/si.php
Expand Up @@ -729,5 +729,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/sv.php
Expand Up @@ -728,5 +728,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/tr.php
Expand Up @@ -731,5 +731,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/zh-tw.php
Expand Up @@ -731,5 +731,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);
2 changes: 2 additions & 0 deletions core/src/plugins/core.ajaxplorer/i18n/zh.php
Expand Up @@ -740,5 +740,7 @@
"628" => "Revert",
"629" => "No records yet",
"630" => "Folders shared with me",
"631" => "Warning, trying to restore from recycle bin on top on an existing file (%s). Please rename this file manually in order to enable restoration from the recycle bin!",
"632" => "Warning, trying to restore from recycle bin on top on an existing folder (%s). Please rename this folder in order to enable restoration from the recycle bin!",
/* END SENTENCE */
);

0 comments on commit 64bd811

Please sign in to comment.