From 8f35f3e6a2c902e9f36924fa6d06ab5f6a3c2184 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 26 May 2017 15:11:57 +0200 Subject: [PATCH 1/3] Fix cross-storage move info when moving between two received shares Need to properly resolve the given path to a source path in `getMoveInfo`. This was missing when adding this new method. --- lib/private/Files/Cache/Wrapper/CacheJail.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index 156bc3599a4d..a7c37f912acd 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -311,4 +311,8 @@ public function moveFromCache(\OCP\Files\Cache\ICache $sourceCache, $sourcePath, } return $this->cache->moveFromCache($sourceCache, $sourcePath, $this->getSourcePath($targetPath)); } + + protected function getMoveInfo($path) { + return [$this->getNumericStorageId(), $this->getSourcePath($path)]; + } } From 2b29079e8860d04e7e9a69b24a628285ed4a1d75 Mon Sep 17 00:00:00 2001 From: Sergio Bertolin Date: Fri, 26 May 2017 12:02:49 +0000 Subject: [PATCH 2/3] Trying to reproduce core#28018 --- .../webdav-related-new-endpoint.feature | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/integration/features/webdav-related-new-endpoint.feature b/tests/integration/features/webdav-related-new-endpoint.feature index d7dd4703305c..15a212deb89e 100644 --- a/tests/integration/features/webdav-related-new-endpoint.feature +++ b/tests/integration/features/webdav-related-new-endpoint.feature @@ -543,3 +543,33 @@ Feature: webdav-related-new-endpoint And user "user0" uploads new chunk file "3" with "CCCCC" to id "chunking-42" When user "user0" moves new chunk file with id "chunking-42" to "/existingFile.txt" Then User "user0" checks id of file "/existingFile.txt" + + + Scenario: Checking file id after a move between received shares + Given using new dav path + And user "user0" exists + And user "user1" exists + And user "user0" created a folder "/folderA" + And user "user0" created a folder "/folderB" + And folder "/folderA" of user "user0" is shared with user "user1" + And folder "/folderB" of user "user0" is shared with user "user1" + And user "user1" created a folder "/folderA/ONE" + And user "user1" created a folder "/folderA/ONE/TWO" + And User "user1" stores id of file "/folderA/ONE" + And User "user1" moves folder "/folderA/ONE" to "/folderB" + When user "user1" created a folder "/folderB/ONE/TWO/THREE" + And using old dav path + Then user "user1" should see following elements + | /FOLDER/ | + | /PARENT/ | + | /PARENT/parent.txt | + | /textfile0.txt | + | /textfile1.txt | + | /textfile2.txt | + | /textfile3.txt | + | /textfile4.txt | + | /folderA | + | /folderB | + | /folderB/ONE | + | /folderB/ONE/TWO | + | /folderB/ONE/TWO/THREE | \ No newline at end of file From cb94e0beac82e6e7a7be36eca151fc74c569590a Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 26 May 2017 15:56:47 +0200 Subject: [PATCH 3/3] Improve tests --- .../webdav-related-new-endpoint.feature | 29 +++++++------------ .../webdav-related-old-endpoint.feature | 21 ++++++++++++++ 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/tests/integration/features/webdav-related-new-endpoint.feature b/tests/integration/features/webdav-related-new-endpoint.feature index 15a212deb89e..1d28fd5d991a 100644 --- a/tests/integration/features/webdav-related-new-endpoint.feature +++ b/tests/integration/features/webdav-related-new-endpoint.feature @@ -544,7 +544,6 @@ Feature: webdav-related-new-endpoint When user "user0" moves new chunk file with id "chunking-42" to "/existingFile.txt" Then User "user0" checks id of file "/existingFile.txt" - Scenario: Checking file id after a move between received shares Given using new dav path And user "user0" exists @@ -554,22 +553,14 @@ Feature: webdav-related-new-endpoint And folder "/folderA" of user "user0" is shared with user "user1" And folder "/folderB" of user "user0" is shared with user "user1" And user "user1" created a folder "/folderA/ONE" - And user "user1" created a folder "/folderA/ONE/TWO" And User "user1" stores id of file "/folderA/ONE" - And User "user1" moves folder "/folderA/ONE" to "/folderB" - When user "user1" created a folder "/folderB/ONE/TWO/THREE" - And using old dav path - Then user "user1" should see following elements - | /FOLDER/ | - | /PARENT/ | - | /PARENT/parent.txt | - | /textfile0.txt | - | /textfile1.txt | - | /textfile2.txt | - | /textfile3.txt | - | /textfile4.txt | - | /folderA | - | /folderB | - | /folderB/ONE | - | /folderB/ONE/TWO | - | /folderB/ONE/TWO/THREE | \ No newline at end of file + And user "user1" created a folder "/folderA/ONE/TWO" + When User "user1" moves folder "/folderA/ONE" to "/folderB/ONE" + Then as "user1" the folder "/folderA" exists + And as "user1" the folder "/folderA/ONE" does not exist + # yes, a weird bug used to make this one fail + And as "user1" the folder "/folderA/ONE/TWO" does not exist + And as "user1" the folder "/folderB/ONE" exists + And as "user1" the folder "/folderB/ONE/TWO" exists + And User "user1" checks id of file "/folderB/ONE" + diff --git a/tests/integration/features/webdav-related-old-endpoint.feature b/tests/integration/features/webdav-related-old-endpoint.feature index f7969f4884df..3bfef345ff8a 100644 --- a/tests/integration/features/webdav-related-old-endpoint.feature +++ b/tests/integration/features/webdav-related-old-endpoint.feature @@ -486,3 +486,24 @@ Feature: webdav-related-old-endpoint When As an "user0" And Downloading file "/myChunkedFile.txt" Then Downloaded content should be "AAAAABBBBBCCCCC" + + Scenario: Checking file id after a move between received shares + Given using old dav path + And user "user0" exists + And user "user1" exists + And user "user0" created a folder "/folderA" + And user "user0" created a folder "/folderB" + And folder "/folderA" of user "user0" is shared with user "user1" + And folder "/folderB" of user "user0" is shared with user "user1" + And user "user1" created a folder "/folderA/ONE" + And User "user1" stores id of file "/folderA/ONE" + And user "user1" created a folder "/folderA/ONE/TWO" + When User "user1" moves folder "/folderA/ONE" to "/folderB/ONE" + Then as "user1" the folder "/folderA" exists + And as "user1" the folder "/folderA/ONE" does not exist + # yes, a weird bug used to make this one fail + And as "user1" the folder "/folderA/ONE/TWO" does not exist + And as "user1" the folder "/folderB/ONE" exists + And as "user1" the folder "/folderB/ONE/TWO" exists + And User "user1" checks id of file "/folderB/ONE" +