diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-09-08 12:11:53 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-09-26 11:21:47 +0200 |
commit | 1f21a132c7a61770a8c54d55fa0789a011746cdf (patch) | |
tree | 261ec6dd3f9bed14e6a27ce5a6496dd1d5410387 | |
parent | 9e91a76b30d9232add8bf2a8fd37572fb21b1207 (diff) | |
download | nextcloud-server-1f21a132c7a61770a8c54d55fa0789a011746cdf.tar.gz nextcloud-server-1f21a132c7a61770a8c54d55fa0789a011746cdf.zip |
Only use realpath for real directories (#26058)
In some cross-local-storage use cases, the Local storage is
instantiated with "/" as data directory. In such cases, calling
realpath() would cause PHP warnings when open_basedir is set.
This fix bypasses the realpath() call when dealing with a root storage.
Downstreaming of https://github.com/owncloud/core/pull/26058
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
-rw-r--r-- | lib/private/Files/Storage/Local.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 19674fc9413..0d63fd46ecc 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -54,7 +54,12 @@ class Local extends \OC\Files\Storage\Common { throw new \InvalidArgumentException('No data directory set for local storage'); } $this->datadir = $arguments['datadir']; - $this->realDataDir = rtrim(realpath($this->datadir), '/') . '/'; + // some crazy code uses a local storage on root... + if ($this->datadir === '/') { + $this->realDataDir = $this->datadir; + } else { + $this->realDataDir = rtrim(realpath($this->datadir), '/') . '/'; + } if (substr($this->datadir, -1) !== '/') { $this->datadir .= '/'; } |