Merge pull request #31217 from nextcloud/bugfix/noid/also-cache-non-existing-entry

Also cache non-existing to reuse it
pull/31309/head
Joas Schilling 2 years ago committed by GitHub
commit 87115d8b1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -97,12 +97,17 @@ class PublicKeyTokenProvider implements IProvider {
$tokenHash = $this->hashToken($tokenId);
if (isset($this->cache[$tokenHash])) {
if ($this->cache[$tokenHash] instanceof DoesNotExistException) {
$ex = $this->cache[$tokenHash];
throw new InvalidTokenException("Token does not exist: " . $ex->getMessage(), 0, $ex);
}
$token = $this->cache[$tokenHash];
} else {
try {
$token = $this->mapper->getToken($this->hashToken($tokenId));
$this->cache[$token->getToken()] = $token;
} catch (DoesNotExistException $ex) {
$this->cache[$tokenHash] = $ex;
throw new InvalidTokenException("Token does not exist: " . $ex->getMessage(), 0, $ex);
}
}

Loading…
Cancel
Save