aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/View.php
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-07-17 02:03:18 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-07-19 19:41:46 +0200
commit9716b0d7350aa28481a5a9642b74da847c0fa211 (patch)
tree0fcf5d02e5a39b60bc0aa60bfaa731b3b489ac08 /lib/private/Files/View.php
parent2e273e477abfc992e2841c3b3b8f19839505a944 (diff)
downloadnextcloud-server-9716b0d7350aa28481a5a9642b74da847c0fa211.tar.gz
nextcloud-server-9716b0d7350aa28481a5a9642b74da847c0fa211.zip
refactor: Migrate some legacy and core functions to `IFilenameValidator`
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib/private/Files/View.php')
-rw-r--r--lib/private/Files/View.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index 26d419842d6..c74206f6ee3 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -1824,6 +1824,12 @@ class View {
* @throws InvalidPathException
*/
public function verifyPath($path, $fileName): void {
+ // All of the view's functions disallow '..' in the path so we can short cut if the path is invalid
+ if (!Filesystem::isValidPath($path ?: '/')) {
+ $l = \OCP\Util::getL10N('lib');
+ throw new InvalidPathException($l->t('Path contains invalid segments'));
+ }
+
try {
/** @type \OCP\Files\Storage $storage */
[$storage, $internalPath] = $this->resolvePath($path);