File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 5252use OCP \Files \IRootFolder ;
5353use OCP \Files \Mount \IMountManager ;
5454use OCP \Files \Node ;
55+ use OCP \Files \NotFoundException ;
5556use OCP \HintException ;
5657use OCP \IConfig ;
5758use OCP \IGroupManager ;
@@ -292,10 +293,18 @@ protected function generalCreateChecks(IShare $share) {
292293 $ permissions = 0 ;
293294
294295 if (!$ isFederatedShare && $ share ->getNode ()->getOwner () && $ share ->getNode ()->getOwner ()->getUID () !== $ share ->getSharedBy ()) {
295- $ userMounts = array_filter ($ userFolder ->getById ($ share ->getNode ()->getId ()), function ($ mount ) use ($ share ) {
296+ try {
297+ $ targetNode = $ share ->getTarget () ? $ userFolder ->get ($ share ->getTarget ()) : null ;
298+ } catch (NotFoundException $ e ) {
299+ $ targetNode = null ;
300+ }
301+ $ userMounts = array_filter ($ userFolder ->getById ($ share ->getNode ()->getId ()), function ($ mount ) use ($ share , $ targetNode ) {
296302 // We need to filter since there might be other mountpoints that contain the file
297303 // e.g. if the user has access to the same external storage that the file is originating from
298- return $ mount ->getStorage ()->instanceOfStorage (ISharedStorage::class) && $ mount ->getPath () === $ share ->getNode ()->getPath ();
304+ return $ mount ->getStorage ()->instanceOfStorage (ISharedStorage::class) && (
305+ $ targetNode ? $ targetNode ->getPath () === $ mount ->getPath () :
306+ $ mount ->getPath () === $ share ->getNode ()->getPath ()
307+ );
299308 });
300309 $ userMount = array_shift ($ userMounts );
301310 if ($ userMount === null ) {
You can’t perform that action at this time.
0 commit comments