Skip to content
Snippets Groups Projects
Commit 95751874 authored by Björn Schießle's avatar Björn Schießle
Browse files

Merge pull request #1740 from houqp/issue#1688

Bug fix for Issue#1688
parents 3d754526 c0ac9806
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,9 @@ if ($path_parts['dirname'] == '.') {
$timestamp = null;
}
if (OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp)) {
OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp);
if (!OCA\Files_Trashbin\Trashbin::file_exists($filename)) {
OCP\JSON::success(array("data" => array("filename" => $file)));
} else {
$l = OC_L10N::get('files_trashbin');
......
......@@ -246,8 +246,27 @@ class Trashbin {
return $size;
}
/**
* check to see whether a file exists in trashbin
* @param $filename path to the file
* @param $timestamp of deletion time
* @return true if file exists, otherwise false
*/
public static function file_exists($filename, $timestamp=null) {
$user = \OCP\User::getUser();
$view = new \OC_FilesystemView('/'.$user);
if ($timestamp) {
$filename = $filename.'.d'.$timestamp;
} else {
$filename = $filename;
}
$target = \OC_Filesystem::normalizePath('files_trashbin/'.$filename);
return $view->file_exists($target);
}
/**
* clean up the trash bin
* @param max. available disk space for trashbin
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment