X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/dav/lib/Connector/Sabre/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,13 @@ public function moveInto($targetName, $fullSourcePath, INode $sourceNode) {
}

$renameOkay = $this->fileView->rename($sourcePath, $destinationPath);

if (!$renameOkay) {
list($targetStorage, $targetInternalPath) = \OC\Files\Filesystem::resolvePath($destinationPath);
if ($isMovableMount === true && $targetStorage->instanceOfStorage('\OCP\Files\IHomeStorage') !== true) {
throw new SabreForbidden('It is not allowed to move one mount point into another one');
}

throw new SabreForbidden('There was an error while renaming the file or directory');
}
} catch (StorageNotAvailableException $e) {
Expand Down
9 changes: 9 additions & 0 deletions changelog/unreleased/39584
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Enhancement: Show detailed error message if moving a mount into another fails

With this change, a detailed error message is shown when moving a mount point
into another mount point fails.
This is for example the case while moving a shared folder into a SFTP
external storage.

https://github.com/owncloud/core/pull/39584
https://github.com/owncloud/core/issues/39550
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ Feature: using files external service with storage as webdav_owncloud
# File should not be moved but here the file is moved to mount storage
But as "Brian" file "TestMountPoint/test.txt" should exist

@issue-39550

Scenario: share receiver tries to move a folder that they have received from someone, to external storage
Given the administrator has created an external mount point with the following configuration about user "Alice" using the occ command
| host | %remote_server% |
Expand All @@ -390,16 +390,10 @@ Feature: using files external service with storage as webdav_owncloud
And user "Carol" has been created with default attributes and without skeleton files
And user "Brian" has created folder "testFolder"
And user "Brian" has shared folder "/testFolder" with user "Carol"
When user "Brian" moves folder "/testFolder" to "TestMountPoint/testFolder" using the WebDAV API
Then the HTTP status code should be "500"
# Uncomment the following line after the issue has been fixed
# Then the HTTP status code should be "403"
# Remove the following line after the issue has been fixed
And the HTTP response message should be "You are not allowed to share /Brian/files/TestMountPoint/testFolder"
# Uncomment the following line after the issue has been fixed
# And the HTTP response message should be "It is not allowed to move one mount point into another one"
When user "Carol" moves folder "/testFolder" to "TestMountPoint/testFolder" using the WebDAV API
Then the HTTP status code should be "403"
And the HTTP response message should be "It is not allowed to move one mount point into another one"

@issue-39550
Scenario: share receiver tries to move a file that they have received from someone, to external storage
Given the administrator has created an external mount point with the following configuration about user "Alice" using the occ command
| host | %remote_server% |
Expand All @@ -414,11 +408,6 @@ Feature: using files external service with storage as webdav_owncloud
And user "Carol" has been created with default attributes and without skeleton files
And user "Brian" has uploaded file with content "Test content for moving file." to "test.txt"
And user "Brian" has shared file "test.txt" with user "Carol"
When user "Brian" moves file "/test.txt" to "TestMountPoint/test.txt" using the WebDAV API
Then the HTTP status code should be "500"
# Uncomment the following line after the issue has been fixed
# Then the HTTP status code should be "403"
# Remove the following line after the issue has been fixed
And the HTTP response message should be "You are not allowed to share /Brian/files/TestMountPoint/test.txt"
# Uncomment the following line after the issue has been fixed
# And the HTTP response message should be "It is not allowed to move one mount point into another one"
When user "Carol" moves file "/test.txt" to "TestMountPoint/test.txt" using the WebDAV API
Then the HTTP status code should be "403"
And the HTTP response message should be "It is not allowed to move one mount point into another one"
X Tutup