@@ -242,9 +242,11 @@ public function remote(string $shareToken, string $remoteServer, string $remoteS
242242 $ share = $ this ->shareManager ->getShareByToken ($ shareToken );
243243 // not authenticated ?
244244 if ($ share ->getPassword ()) {
245- if (!$ this ->session ->exists ('public_link_authenticated ' )
246- || $ this ->session ->get ('public_link_authenticated ' ) !== (string )$ share ->getId ()
247- ) {
245+ $ authenticatedLinks = $ this ->session ->get ('public_link_authenticated ' );
246+
247+ $ isAuthenticated = (is_array ($ authenticatedLinks ) && in_array ($ share ->getId (), $ authenticatedLinks ));
248+ $ isAuthenticated = $ isAuthenticated || ($ authenticatedLinks === (string )$ share ->getId ());
249+ if (!$ isAuthenticated ) {
248250 throw new Exception ('Invalid password ' );
249251 }
250252 }
@@ -459,9 +461,12 @@ private function getFileForUser(int $fileId, ?string $path = null): File {
459461 private function getFileForShare (IShare $ share , ?int $ fileId , ?string $ path = null ): File {
460462 // not authenticated ?
461463 if ($ share ->getPassword ()) {
462- if (!$ this ->session ->exists ('public_link_authenticated ' )
463- || $ this ->session ->get ('public_link_authenticated ' ) !== (string )$ share ->getId ()
464- ) {
464+ $ authenticatedLinks = $ this ->session ->get ('public_link_authenticated ' );
465+
466+ $ isAuthenticated = (is_array ($ authenticatedLinks ) && in_array ($ share ->getId (), $ authenticatedLinks ));
467+ $ isAuthenticated = $ isAuthenticated || ($ authenticatedLinks === (string )$ share ->getId ());
468+
469+ if (!$ isAuthenticated ) {
465470 throw new NotPermittedException ('Invalid password ' );
466471 }
467472 }
0 commit comments