Skip to content

Commit b89f224

Browse files
author
Johannes Leuker
committed
Add 'allow Symlinks' as an option to config.php
Signed-off-by: Johannes Leuker <j.leuker@hosting.de>
1 parent e25a62c commit b89f224

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

config/config.sample.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,6 +1603,15 @@
16031603
*/
16041604
'minimum.supported.desktop.version' => '2.0.0',
16051605

1606+
/**
1607+
* Option to allow local storage to contain symlinks.
1608+
* WARNING: Not recommended. This would make it possible for Nextcloud to access
1609+
* files outside the data directory and could be considered a security risk.
1610+
*
1611+
* Defaults to ``false``
1612+
*/
1613+
'localstorage.allowsymlinks' => false,
1614+
16061615
/**
16071616
* EXPERIMENTAL: option whether to include external storage in quota
16081617
* calculation, defaults to false.

lib/private/Files/Storage/Local.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ class Local extends \OC\Files\Storage\Common {
5757

5858
protected $dataDirLength;
5959

60-
protected $allowSymlinks = false;
61-
6260
protected $realDataDir;
6361

6462
public function __construct($arguments) {
@@ -441,7 +439,8 @@ public function getSourcePath($path) {
441439

442440
$fullPath = $this->datadir . $path;
443441
$currentPath = $path;
444-
if ($this->allowSymlinks || $currentPath === '') {
442+
$allowSymlinks = \OC::$server->getConfig()->getSystemValue('localstorage.allowsymlinks', false);
443+
if ($allowSymlinks || $currentPath === '') {
445444
return $fullPath;
446445
}
447446
$pathToResolve = $fullPath;

0 commit comments

Comments
 (0)