File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99namespace OCA \DAV \DAV ;
1010
11+ use OCA \DAV \Connector \Sabre \Directory ;
1112use OCA \DAV \Connector \Sabre \Exception \Forbidden ;
1213use OCA \DAV \Connector \Sabre \File as DavFile ;
1314use OCA \Files_Versions \Sabre \VersionFile ;
@@ -95,6 +96,17 @@ public function checkViewOnly(RequestInterface $request): bool {
9596 break ;
9697 case 'COPY ' :
9798 case 'MOVE ' :
99+ $ destinationPath = $ this ->server ->getCopyAndMoveInfo ($ request )['destination ' ];
100+ $ destinationParentPath = dirname ($ destinationPath );
101+ if ($ destinationParentPath === '. ' ) {
102+ $ destinationParentPath = '' ;
103+ }
104+ $ destinationParent = $ this ->server ->tree ->getNodeForPath ($ destinationParentPath );
105+ // Copy and move operations within the same storage are allowed, because the destination has the same restrictions.
106+ if (($ destinationParent instanceof Directory) && $ destinationParent ->getNode ()->getStorage ()->getId () === $ storage ->getId ()) {
107+ break ;
108+ }
109+
98110 // If download is disabled, we disable the COPY and MOVE methods even if the shareapi_allow_view_without_download is set to true.
99111 if (!$ share ->canDownload ()) {
100112 throw new Forbidden ('Access to this shared resource has been denied because its download permission is disabled. ' );
You can’t perform that action at this time.
0 commit comments