diff options
author | Julien Veyssier <eneiluj@posteo.net> | 2021-11-26 13:08:10 +0300 |
---|---|---|
committer | Julien Veyssier <eneiluj@posteo.net> | 2022-01-03 12:27:37 +0300 |
commit | a2fcb4debdb5038c1b3445c222a5fc418277d7bc (patch) | |
tree | 9e798d874704433bbc1b18ca49186f073804952f | |
parent | 0762feb2b175685f3e1c9f185571184f302c63a2 (diff) |
fix moveAttachments in shared context (single file and directory share)
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
-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()); } } |