Bug 30803: Don't hardcode 404 into output_error

This patch removes the hardcoded "404 Not Found" status
code and reason phrase from output_error and instead
uses just the code passed into the function.

Test Plan:
0. Apply patch and koha-plack --restart kohadev
1. Go to http://localhost:8080/cgi-bin/koha/tracklinks.pl?uri=https%3A%2F%2Ftest.com&biblionumber=29
2. Note normal OPAC 404 error

Bonus points:
1. Change 404 to 403 in the first output_error in opac/tracklinks.pl
2. koha-plack --restart kohadev
3. Go to http://localhost:8080/cgi-bin/koha/tracklinks.pl?uri=https%3A%2F%2Ftest.com&biblionumber=29
4. Note normal OPAC 403 error

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit beea9253e5)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
David Cook 2026-01-13 01:57:04 +00:00 committed by Jacob O'Mara
parent b65fa54bc0
commit 9b4de43725
No known key found for this signature in database
1 changed files with 3 additions and 1 deletions

View File

@ -405,7 +405,9 @@ sub output_error {
admin => $admin,
errno => $error,
);
output_with_http_headers $query, $cookie, $template->output, 'html', '404 Not Found';
#NOTE: Technically, it is enough to just include the status code. You don't have to include the reason phrase.
output_with_http_headers $query, $cookie, $template->output, 'html', $error;
}
=item parametrized_url