diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Service/ImageService.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Service/ImageService.php b/lib/Service/ImageService.php index 5c6db0259..5c6941def 100644 --- a/lib/Service/ImageService.php +++ b/lib/Service/ImageService.php @@ -635,9 +635,12 @@ class ImageService { public function moveAttachments(File $source, File $target): void { // if the parent directory has changed if ($source->getParent()->getPath() !== $target->getParent()->getPath()) { - // if there is an attachment dir for this file $sourceAttachmentDir = $this->getAttachmentDirectoryForFile($source); - if ($sourceAttachmentDir !== null) { + // if there is an attachment dir for this file + // and it is in the same directory as the source file + if ($sourceAttachmentDir !== null + && $source->getParent()->getId() === $sourceAttachmentDir->getParent()->getId() + ) { $sourceAttachmentDir->move($target->getParent()->getPath() . '/' . $sourceAttachmentDir->getName()); } } |