Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
debug(SessionMiddleware): Log if we have an invalid session
We have spotted occurrences of this in combination with out-of-sync
situations, so let's log it for now to better debug when this happens.

Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- authored and backportbot[bot] committed Jun 30, 2025
commit 28df1f2caff3205097a4f3fe272472505a4c799d
6 changes: 6 additions & 0 deletions lib/Middleware/SessionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use OCP\IUserSession;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager as ShareManager;
use Psr\Log\LoggerInterface;
use ReflectionException;

class SessionMiddleware extends Middleware {
Expand All @@ -43,6 +44,7 @@ public function __construct(
private IRootFolder $rootFolder,
private ShareManager $shareManager,
private IL10N $l10n,
private LoggerInterface $logger,
) {
}

Expand Down Expand Up @@ -99,11 +101,15 @@ private function assertDocumentSession(ISessionAwareController $controller): voi

$session = $this->sessionService->getValidSession($documentId, $sessionId, $token);
if (!$session) {
// We spotted occurrences of this in combination with out-of-sync situations, so let's log it for now.
$this->logger->error('Could not find document session for document id' . $documentId . ' and session id ' . $sessionId);
throw new InvalidSessionException();
}

$document = $this->documentService->getDocument($documentId);
if (!$document) {
// We spotted occurrences of this in combination with out-of-sync situations, so let's log it for now.
$this->logger->error('Could not find document for documentId ' . $documentId);
throw new InvalidSessionException();
}

Expand Down
Loading