From 39a4b1c4011ba9b9f5c88679baadd79c8d1cf343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 29 Jan 2021 08:43:17 +0100 Subject: [PATCH] Normalize compared path to avoid renaming to the same directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Files/Template/TemplateManager.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/private/Files/Template/TemplateManager.php b/lib/private/Files/Template/TemplateManager.php index 813f3fe83e..277411279f 100644 --- a/lib/private/Files/Template/TemplateManager.php +++ b/lib/private/Files/Template/TemplateManager.php @@ -28,6 +28,7 @@ namespace OC\Files\Template; use OC\AppFramework\Bootstrap\Coordinator; use OC\Files\Cache\Scanner; +use OC\Files\Filesystem; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Folder; use OCP\Files\File; @@ -272,7 +273,7 @@ class TemplateManager implements ITemplateManager { if (!$userFolder->nodeExists('Templates')) { return ''; } - $newPath = $userFolder->getPath() . '/' . $userTemplatePath; + $newPath = Filesystem::normalizePath($userFolder->getPath() . '/' . $userTemplatePath); if ($newPath !== $userFolder->get('Templates')->getPath()) { $userFolder->get('Templates')->move($newPath); }