diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-09-08 15:14:20 +0200 |
---|---|---|
committer | Thomas Müller <DeepDiver1975@users.noreply.github.com> | 2016-09-08 15:14:20 +0200 |
commit | 6fe80377e8907241bd4e40bde43c41f76b43ef9b (patch) | |
tree | 1efe9053a15cc1f6501e6b945056f00cb5a8c38f | |
parent | f572239546b5a22c2ce2b7fc8489013b62ac75ce (diff) | |
download | nextcloud-server-6fe80377e8907241bd4e40bde43c41f76b43ef9b.tar.gz nextcloud-server-6fe80377e8907241bd4e40bde43c41f76b43ef9b.zip |
Only use realpath for real directories (#26060)
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.
-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 005b5f9ab91..317f25eddcf 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -53,7 +53,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 .= '/'; } |