diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 6ffb5edff3e2afb3d886fc7f47d4aac3736ab773..506128d7fcd0bcbd1f432f8e759989ec3e8ed789 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -96,8 +96,12 @@ class View { private $updaterEnabled = true; + /** @var \OC\User\Manager */ private $userManager; + /** @var \OCP\ILogger */ + private $logger; + /** * @param string $root * @throws \Exception If $root contains an invalid path @@ -114,6 +118,7 @@ class View { $this->lockingProvider = \OC::$server->getLockingProvider(); $this->lockingEnabled = !($this->lockingProvider instanceof \OC\Lock\NoopLockingProvider); $this->userManager = \OC::$server->getUserManager(); + $this->logger = \OC::$server->getLogger(); } public function getAbsolutePath($path = '/') { @@ -2068,6 +2073,12 @@ class View { $parts = explode('/', trim($path, '/'), 3); // "$user", "files", "path/to/dir" if (!isset($parts[1]) || $parts[1] !== 'files') { + $this->logger->error( + '$absolutePath must be relative to "files", value is "%s"', + [ + $absolutePath + ] + ); throw new \InvalidArgumentException('$absolutePath must be relative to "files"'); } if (isset($parts[2])) { diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index 0aaeb094cd4b90114d5c0b5dca3f0fc2d014541b..3635323e169e8b03c1943026cf0e9a1be3f50166 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -1488,6 +1488,8 @@ class ViewTest extends \Test\TestCase { /** * @dataProvider pathRelativeToFilesProviderExceptionCases * @expectedException \InvalidArgumentException + * @expectedExceptionMessage $absolutePath must be relative to "files" + * @param string $path */ public function testGetPathRelativeToFilesWithInvalidArgument($path) { $view = new View();