From 45784f213f5e7cf9a38feabd52c4ffadee9ae4f9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 20 Apr 2015 16:46:35 +0200 Subject: [PATCH] fix propagation when renaming a directly reshared folder --- apps/files_sharing/lib/propagation/changewatcher.php | 6 ++++-- lib/private/files/view.php | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/lib/propagation/changewatcher.php b/apps/files_sharing/lib/propagation/changewatcher.php index 33048081f9..483f436e28 100644 --- a/apps/files_sharing/lib/propagation/changewatcher.php +++ b/apps/files_sharing/lib/propagation/changewatcher.php @@ -9,6 +9,7 @@ namespace OCA\Files_Sharing\Propagation; use OC\Files\Cache\ChangePropagator; +use OC\Files\Filesystem; use OC\Files\View; use OCA\Files_Sharing\SharedMount; @@ -47,10 +48,10 @@ class ChangeWatcher { $fullPath2 = $this->baseView->getAbsolutePath($path2); $mount1 = $this->baseView->getMount($path1); $mount2 = $this->baseView->getMount($path2); - if ($mount1 instanceof SharedMount) { + if ($mount1 instanceof SharedMount and $mount1->getInternalPath($fullPath1) !== '') { $this->propagateForOwner($mount1->getShare(), $mount1->getInternalPath($fullPath1), $mount1->getOwnerPropagator()); } - if ($mount1 !== $mount2 and $mount2 instanceof SharedMount) { + if ($mount1 !== $mount2 and $mount2 instanceof SharedMount and $mount2->getInternalPath($fullPath2) !== '') { $this->propagateForOwner($mount2->getShare(), $mount2->getInternalPath($fullPath2), $mount2->getOwnerPropagator()); } } @@ -67,6 +68,7 @@ class ChangeWatcher { $shareRootPath = $view->getPath($share['item_source']); if (!is_null($shareRootPath)) { $path = $shareRootPath . '/' . $internalPath; + $path = Filesystem::normalizePath($path); $propagator->addChange($path); $propagator->propagateChanges(); } diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 162bf568de..63af2b616c 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -658,6 +658,10 @@ class View { } elseif ($result) { if ($internalPath1 !== '') { // dont do a cache update for moved mounts $this->updater->rename($path1, $path2); + } else { // only do etag propagation + $this->getUpdater()->getPropagator()->addChange($path1); + $this->getUpdater()->getPropagator()->addChange($path2); + $this->getUpdater()->getPropagator()->propagateChanges(); } if ($this->shouldEmitHooks($path1) and $this->shouldEmitHooks($path2)) { \OC_Hook::emit(