summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/sharedstorage.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/lib/sharedstorage.php')
-rw-r--r--apps/files_sharing/lib/sharedstorage.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index 6a2905b52c9..4530ce87777 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -209,7 +209,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
public function isDeletable($path) {
if ($path == '') {
- return false;
+ return true;
}
return ($this->getPermissions($path) & OCP\Share::PERMISSION_DELETE);
}
@@ -306,9 +306,19 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
public function unlink($path) {
// Delete the file if DELETE permission is granted
- if (($source = $this->getSourcePath($path)) && $this->isDeletable($path)) {
- $storage = OC_Filesystem::getStorage($source);
- return $storage->unlink($this->getInternalPath($source));
+ if ($source = $this->getSourcePath($path)) {
+ if ($this->isDeletable($path)) {
+ $storage = OC_Filesystem::getStorage($source);
+ return $storage->unlink($this->getInternalPath($source));
+ } else if (dirname($path) == '/' || dirname($path) == '.') {
+ // Unshare the file from the user if in the root of the Shared folder
+ if ($this->is_dir($path)) {
+ $itemType = 'folder';
+ } else {
+ $itemType = 'file';
+ }
+ return OCP\Share::unshareFromSelf($itemType, $path);
+ }
}
return false;
}