@@ -209,7 +209,7 @@ protected function verifyPassword($password) {
209209 *
210210 * @suppress PhanUndeclaredClassMethod
211211 */
212- protected function generalCreateChecks (IShare $ share ) {
212+ protected function generalCreateChecks (IShare $ share, bool $ isUpdate = false ) {
213213 if ($ share ->getShareType () === IShare::TYPE_USER ) {
214214 // We expect a valid user as sharedWith for user shares
215215 if (!$ this ->userManager ->userExists ($ share ->getSharedWith ())) {
@@ -294,8 +294,14 @@ protected function generalCreateChecks(IShare $share) {
294294
295295 $ isFederatedShare = $ share ->getNode ()->getStorage ()->instanceOfStorage ('\OCA\Files_Sharing\External\Storage ' );
296296 $ permissions = 0 ;
297+
298+ $ isReshare = $ share ->getNode ()->getOwner () && $ share ->getNode ()->getOwner ()->getUID () !== $ share ->getSharedBy ();
299+ if (!$ isReshare && $ isUpdate ) {
300+ // in case of update on owner-less filesystem, we use share owner to improve reshare detection
301+ $ isReshare = $ share ->getShareOwner () !== $ share ->getSharedBy ();
302+ }
297303
298- if (!$ isFederatedShare && $ share -> getNode ()-> getOwner () && $ share -> getNode ()-> getOwner ()-> getUID () !== $ share -> getSharedBy () ) {
304+ if (!$ isFederatedShare && $ isReshare ) {
299305 $ userMounts = array_filter ($ userFolder ->getById ($ share ->getNode ()->getId ()), function ($ mount ) {
300306 // We need to filter since there might be other mountpoints that contain the file
301307 // e.g. if the user has access to the same external storage that the file is originating from
@@ -987,7 +993,7 @@ public function updateShare(IShare $share) {
987993 throw new \InvalidArgumentException ('Cannot share with the share owner ' );
988994 }
989995
990- $ this ->generalCreateChecks ($ share );
996+ $ this ->generalCreateChecks ($ share, true );
991997
992998 if ($ share ->getShareType () === IShare::TYPE_USER ) {
993999 $ this ->userCreateChecks ($ share );
0 commit comments