diff options
author | Robin Appelman <robin@icewind.nl> | 2022-03-28 18:46:38 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-04-04 15:40:12 +0200 |
commit | 700444e21801002cc24093229d8ac7714d2e1486 (patch) | |
tree | 46bd32aa57aa2218eb6ec3109ce19fd7dd8d1e77 /lib/private/Files/Node/Folder.php | |
parent | 99ac46d8f5de241b49e33e2c4fb874270f6860cc (diff) | |
download | nextcloud-server-700444e21801002cc24093229d8ac7714d2e1486.tar.gz nextcloud-server-700444e21801002cc24093229d8ac7714d2e1486.zip |
split out some path manipulation logic
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Node/Folder.php')
-rw-r--r-- | lib/private/Files/Node/Folder.php | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php index 400fd6bedcc..3c40ee455fa 100644 --- a/lib/private/Files/Node/Folder.php +++ b/lib/private/Files/Node/Folder.php @@ -36,6 +36,7 @@ use OC\Files\Cache\Wrapper\CacheJail; use OC\Files\Search\SearchComparison; use OC\Files\Search\SearchOrder; use OC\Files\Search\SearchQuery; +use OC\Files\Utils\PathHelper; use OCP\Files\Cache\ICacheEntry; use OCP\Files\FileInfo; use OCP\Files\Mount\IMountPoint; @@ -76,17 +77,7 @@ class Folder extends Node implements \OCP\Files\Folder { * @return string|null */ public function getRelativePath($path) { - if ($this->path === '' or $this->path === '/') { - return $this->normalizePath($path); - } - if ($path === $this->path) { - return '/'; - } elseif (strpos($path, $this->path . '/') !== 0) { - return null; - } else { - $path = substr($path, strlen($this->path)); - return $this->normalizePath($path); - } + return PathHelper::getRelativePath($this->getPath(), $path); } /** |