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 ;
@@ -94,6 +95,17 @@ public function checkViewOnly(RequestInterface $request): bool {
9495 break ;
9596 case 'COPY ' :
9697 case 'MOVE ' :
98+ $ destinationPath = $ this ->server ->getCopyAndMoveInfo ($ request )['destination ' ];
99+ $ destinationParentPath = dirname ($ destinationPath );
100+ if ($ destinationParentPath === '. ' ) {
101+ $ destinationParentPath = '' ;
102+ }
103+ $ destinationParent = $ this ->server ->tree ->getNodeForPath ($ destinationParentPath );
104+ // Copy and move operations within the same storage are allowed, because the destination has the same restrictions.
105+ if (($ destinationParent instanceof Directory) && $ destinationParent ->getNode ()->getStorage ()->getId () === $ storage ->getId ()) {
106+ break ;
107+ }
108+
97109 // If download is disabled, we disable the COPY and MOVE methods even if the shareapi_allow_view_without_download is set to true.
98110 if (!$ share ->canDownload ()) {
99111 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