summaryrefslogtreecommitdiffstats
path: root/lib/private/files
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-05-20 18:31:32 +0200
committerVincent Petry <pvince81@owncloud.com>2015-09-22 11:34:37 +0200
commitb9cd5bc1dc3c68701804013f218b7866621a8d40 (patch)
treea27b049150d102663c9b174f78c661cdebd9e2e1 /lib/private/files
parent67231ed9a75eafe5b417e4525e3d80b1a3f8826b (diff)
downloadnextcloud-server-b9cd5bc1dc3c68701804013f218b7866621a8d40.tar.gz
nextcloud-server-b9cd5bc1dc3c68701804013f218b7866621a8d40.zip
Prevent wrong matches in getRelativePath
Before this fix, the root "/files" with path "/files_trashbin" would return "_trashbin" as relative path...
Diffstat (limited to 'lib/private/files')
-rw-r--r--lib/private/files/view.php5
1 files changed, 4 insertions, 1 deletions
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));