Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2021-03-16 17:34:41 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-03-19 18:47:09 +0300
commitec0ca19debce12026a071c10e6331160b4dd6b92 (patch)
tree29997202be5249d80dfc1708e400266f65dba592 /apps/files_external
parentceed64154fcd33d94a68a2f23772adb02daaa1bc (diff)
add (hidden) option to always show smb root as writable
some smb servers are very insistent in reporting that the root of the share is readonly, even if it isn't. This works around the problem by adding a hidden option to overwrite the permissions of the root of the share. This can be enabled using ```bash occ files_external:config <mount id> root_force_writable true ``` where you can find your mount id using ```bash occ files_external:list ``` Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php
index 6c8d9e0a062..25732ee8e2a 100644
--- a/apps/files_external/lib/Lib/Storage/SMB.php
+++ b/apps/files_external/lib/Lib/Storage/SMB.php
@@ -97,6 +97,9 @@ 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');
@@ -134,6 +137,7 @@ 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);
@@ -567,7 +571,11 @@ class SMB extends Common implements INotifyStorage {
private function getMetaDataFromFileInfo(IFileInfo $fileInfo) {
$permissions = Constants::PERMISSION_READ + Constants::PERMISSION_SHARE;
- if (!$fileInfo->isReadOnly()) {
+ if (
+ !$fileInfo->isReadOnly() || (
+ $this->rootWritable && $fileInfo->getPath() == $this->buildPath('')
+ )
+ ) {
$permissions += Constants::PERMISSION_DELETE;
$permissions += Constants::PERMISSION_UPDATE;
if ($fileInfo->isDirectory()) {