Bug 30979: (follow-up) Fix public availability 500

When we introduced the logged in user id to the token generation we
had the knock on effect of creating a 500 response for unauthenticated
availability lookups.

This patch resolves the 500, but results in a token that's not useful
for the end user.  We should consider this in the wider context down the
line.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2023-05-17 19:56:43 +01:00 committed by Tomas Cohen Arazi
parent 89b008bccd
commit 96bbd70d2d
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 1 additions and 1 deletions

View File

@ -161,7 +161,7 @@ sub get_availability {
$c->_check_availability( $patron, $item );
my $confirm_keys = join( ":", sort keys %{$confirmation} );
$confirm_keys = $user->id . ":" . $item->id . ":" . $confirm_keys;
$confirm_keys = $user ? $user->id : '' . ":" . $item->id . ":" . $confirm_keys;
my $token = Koha::Token->new->generate_jwt( { id => $confirm_keys } );
my $response = {