File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -180,12 +180,23 @@ private function init() {
180180 $ this ->cache = new FailedCache ();
181181 $ this ->rootPath = '' ;
182182 } else {
183- $ this ->nonMaskedStorage = $ ownerNode ->getStorage ();
184- if ($ this ->nonMaskedStorage instanceof Wrapper && $ this ->nonMaskedStorage ->isWrapperOf ($ this )) {
183+ foreach ($ ownerNodes as $ ownerNode ) {
184+ $ nonMaskedStorage = $ ownerNode ->getStorage ();
185+
186+ // check if potential source node would lead to a recursive share setup
187+ if ($ nonMaskedStorage instanceof Wrapper && $ nonMaskedStorage ->isWrapperOf ($ this )) {
188+ continue ;
189+ }
190+ $ this ->nonMaskedStorage = $ nonMaskedStorage ;
191+ $ this ->sourcePath = $ ownerNode ->getPath ();
192+ $ this ->rootPath = $ ownerNode ->getInternalPath ();
193+ $ this ->cache = null ;
194+ break ;
195+ }
196+ if (!$ this ->nonMaskedStorage ) {
197+ // all potential source nodes would have been recursive
185198 throw new \Exception ('recursive share detected ' );
186199 }
187- $ this ->sourcePath = $ ownerNode ->getPath ();
188- $ this ->rootPath = $ ownerNode ->getInternalPath ();
189200 $ this ->storage = new PermissionsMask ([
190201 'storage ' => $ this ->nonMaskedStorage ,
191202 'mask ' => $ this ->superShare ->getPermissions (),
You can’t perform that action at this time.
0 commit comments