diff options
author | Juan Pablo VillafaƱez <jvillafanez@solidgear.es> | 2016-07-20 14:22:04 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-07-20 14:45:42 +0200 |
commit | c376eb9f90dbf51c35d9997f36c275a9ba780e82 (patch) | |
tree | ac0766caa3370f6558c7dd72483347967d72d1da /apps/files_external | |
parent | b37e1ed17f54916e3321427d92afa3f74ebea1b3 (diff) | |
download | nextcloud-server-c376eb9f90dbf51c35d9997f36c275a9ba780e82.tar.gz nextcloud-server-c376eb9f90dbf51c35d9997f36c275a9ba780e82.zip |
Fix file permissions for SMB (read-only folders will be writeable) (#25301)
* Fix file permissions for SMB (read-only folders will be writeable)
* Read-only folders won't be deletable
* Added comment for the read-only behaviour for folders
Diffstat (limited to 'apps/files_external')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SMB.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index e677f8c9eba..b9613adff21 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -383,6 +383,19 @@ class SMB extends \OC\Files\Storage\Common { public function isUpdatable($path) { try { $info = $this->getFileInfo($path); + // following windows behaviour for read-only folders: they can be written into + // (https://support.microsoft.com/en-us/kb/326549 - "cause" section) + return !$info->isHidden() && (!$info->isReadOnly() || $this->is_dir($path)); + } catch (NotFoundException $e) { + return false; + } catch (ForbiddenException $e) { + return false; + } + } + + public function isDeletable($path) { + try { + $info = $this->getFileInfo($path); return !$info->isHidden() && !$info->isReadOnly(); } catch (NotFoundException $e) { return false; |