Skip to content

Commit ac88bcb

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 15924b8 commit ac88bcb

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

config/config.sample.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,15 @@
16191619
*/
16201620
'minimum.supported.desktop.version' => '2.0.0',
16211621

1622+
/**
1623+
* Option to allow local storage to contain symlinks.
1624+
* WARNING: Not recommended. This would make it possible for Nextcloud to access
1625+
* files outside the data directory and could be considered a security risk.
1626+
*
1627+
* Defaults to ``false``
1628+
*/
1629+
'localstorage.allowsymlinks' => false,
1630+
16221631
/**
16231632
* EXPERIMENTAL: option whether to include external storage in quota
16241633
* calculation, defaults to false.

lib/private/Files/Storage/Local.php

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

5959
protected $dataDirLength;
6060

61-
protected $allowSymlinks = false;
62-
6361
protected $realDataDir;
6462

6563
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)