From b9cd5bc1dc3c68701804013f218b7866621a8d40 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 20 May 2015 18:31:32 +0200 Subject: Prevent wrong matches in getRelativePath Before this fix, the root "/files" with path "/files_trashbin" would return "_trashbin" as relative path... --- lib/private/files/view.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/private/files') diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 9afa9d40b20..d3c88e9d490 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -153,7 +153,10 @@ class View { return '/'; } - if (strpos($path, $this->fakeRoot) !== 0) { + // missing slashes can cause wrong matches! + $root = rtrim($this->fakeRoot, '/') . '/'; + + if (strpos($path, $root) !== 0) { return null; } else { $path = substr($path, strlen($this->fakeRoot)); -- cgit v1.2.3