diff --git a/lib/Controller/WopiController.php b/lib/Controller/WopiController.php index 656dc139e3..0550b03ffe 100644 --- a/lib/Controller/WopiController.php +++ b/lib/Controller/WopiController.php @@ -127,10 +127,10 @@ public function checkFileInfo(string $fileId, string $access_token): JSONRespons return new JSONResponse([], Http::STATUS_FORBIDDEN); } - $isPublic = empty($wopi->getEditorUid()); + $isPublic = $wopi->getShare() !== null || empty($wopi->getEditorUid()); $guestUserId = 'Guest-' . \OCP\Server::get(\OCP\Security\ISecureRandom::class)->generate(8); $user = $this->userManager->get($wopi->getEditorUid()); - $userDisplayName = $user !== null && !$isPublic ? $user->getDisplayName() : $wopi->getGuestDisplayname(); + $userDisplayName = $user !== null ? $user->getDisplayName() : $wopi->getGuestDisplayname(); $isVersion = $version !== '0'; $isSmartPickerEnabled = (bool)$wopi->getCanwrite() && !$isPublic && !$wopi->getDirect(); $isTaskProcessingEnabled = $isSmartPickerEnabled && $this->taskProcessingManager->isTaskProcessingEnabled(); @@ -146,7 +146,7 @@ public function checkFileInfo(string $fileId, string $access_token): JSONRespons } catch (NoLockProviderException|PreConditionNotMetException) { } - $userId = !$isPublic ? $wopi->getEditorUid() : $guestUserId; + $userId = !empty($wopi->getEditorUid()) ? $wopi->getEditorUid() : $guestUserId; $response = [