]> source.dussan.org Git - nextcloud-server.git/commitdiff
ignore readonly flag for directories 26964/head
authorRobin Appelman <robin@icewind.nl>
Thu, 25 Mar 2021 11:03:09 +0000 (12:03 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Wed, 12 May 2021 16:26:32 +0000 (16:26 +0000)
see http://support.microsoft.com/kb/326549

Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_external/lib/Lib/Storage/SMB.php

index 4d205ce9c68105043f473fe9970d6a6fdbc92e13..e795e7cfd9212201eab09e7d4748ba3907cc6379 100644 (file)
@@ -97,9 +97,6 @@ class SMB extends Common implements INotifyStorage {
        /** @var bool */
        protected $checkAcl;
 
-       /** @var bool */
-       protected $rootWritable;
-
        public function __construct($params) {
                if (!isset($params['host'])) {
                        throw new \Exception('Invalid configuration, no host provided');
@@ -137,7 +134,6 @@ class SMB extends Common implements INotifyStorage {
 
                $this->showHidden = isset($params['show_hidden']) && $params['show_hidden'];
                $this->checkAcl = isset($params['check_acl']) && $params['check_acl'];
-               $this->rootWritable = isset($params['root_force_writable']) && $params['root_force_writable'];
 
                $this->statCache = new CappedMemoryCache();
                parent::__construct($params);
@@ -578,9 +574,7 @@ class SMB extends Common implements INotifyStorage {
                $permissions = Constants::PERMISSION_READ + Constants::PERMISSION_SHARE;
 
                if (
-                       !$fileInfo->isReadOnly() || (
-                               $this->rootWritable && $fileInfo->getPath() == $this->buildPath('')
-                       )
+                       !$fileInfo->isReadOnly() || $fileInfo->isDirectory()
                ) {
                        $permissions += Constants::PERMISSION_DELETE;
                        $permissions += Constants::PERMISSION_UPDATE;
@@ -683,7 +677,7 @@ class SMB extends Common implements INotifyStorage {
                        $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 ($this->showHidden || !$info->isHidden()) && (!$info->isReadOnly() || $this->is_dir($path));
+                       return ($this->showHidden || !$info->isHidden()) && (!$info->isReadOnly() || $info->isDirectory());
                } catch (NotFoundException $e) {
                        return false;
                } catch (ForbiddenException $e) {