Merge pull request #24606 from hosting-de/feature/allow-symlinks-configurable

Add 'allow Symlinks' as an option to config.php
This commit is contained in:
Vincent Petry 2021-01-12 13:20:26 +01:00 committed by GitHub
commit 90c0e943dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -1619,6 +1619,15 @@ $CONFIG = [
*/
'minimum.supported.desktop.version' => '2.0.0',
/**
* Option to allow local storage to contain symlinks.
* WARNING: Not recommended. This would make it possible for Nextcloud to access
* files outside the data directory and could be considered a security risk.
*
* Defaults to ``false``
*/
'localstorage.allowsymlinks' => false,
/**
* EXPERIMENTAL: option whether to include external storage in quota
* calculation, defaults to false.

View File

@ -58,8 +58,6 @@ class Local extends \OC\Files\Storage\Common {
protected $dataDirLength;
protected $allowSymlinks = false;
protected $realDataDir;
public function __construct($arguments) {
@ -441,7 +439,8 @@ class Local extends \OC\Files\Storage\Common {
$fullPath = $this->datadir . $path;
$currentPath = $path;
if ($this->allowSymlinks || $currentPath === '') {
$allowSymlinks = \OC::$server->getConfig()->getSystemValue('localstorage.allowsymlinks', false);
if ($allowSymlinks || $currentPath === '') {
return $fullPath;
}
$pathToResolve = $fullPath;