Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulien Veyssier <eneiluj@posteo.net>2021-11-26 13:08:10 +0300
committerJulien Veyssier <eneiluj@posteo.net>2022-01-03 12:27:37 +0300
commita2fcb4debdb5038c1b3445c222a5fc418277d7bc (patch)
tree9e798d874704433bbc1b18ca49186f073804952f /lib
parent0762feb2b175685f3e1c9f185571184f302c63a2 (diff)
fix moveAttachments in shared context (single file and directory share)
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/Service/ImageService.php7
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());
}
}