Normalize compared path to avoid renaming to the same directory

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2021-01-29 08:43:17 +01:00
parent 395826b81a
commit 39a4b1c401
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 2 additions and 1 deletions

View File

@ -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);
}