Bugzilla – Attachment 68157 Details for
Bug 19439
Some error responses from opac/unapi get lost in eval
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19439: Remove eval with exit statements from opac/unapi
Bug-19439-Remove-eval-with-exit-statements-from-op.patch (text/plain), 2.51 KB, created by
Katrin Fischer
on 2017-10-15 08:29:41 UTC
(
hide
)
Description:
Bug 19439: Remove eval with exit statements from opac/unapi
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2017-10-15 08:29:41 UTC
Size:
2.51 KB
patch
obsolete
>From 7919a15046abd4d812e3313e69bd4eb6b807416f Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 9 Oct 2017 15:12:05 +0200 >Subject: [PATCH] Bug 19439: Remove eval with exit statements from opac/unapi > >The script contains some error responses that get lost when using them >in an eval statement. (Since exit should not be used within an eval >construction.) The eval is removed now. > >Test plan: >[1] Before applying this patch, you could look at the current responses > from unapi for the calls in the next steps. Apply the patch now. >[2] Call http(s)://[your-server]/cgi-bin/koha/unapi with only a format > parameter. > Check if you have a 400 status response. (In Firefox, look at Network > tab of Developer Tools.) > Note: Have to admit (reluctantly) that MS Edge shows the status code in > the browser rightaway in contrast with Firefox. >[3] Call unapi with a format=marcxml&id=999 > The wrong id parameter should trigger a 404 response. >[4] Call unapi with format=marcxml&id=koha:biblionumber:[notexist] > where notexist is a biblionumber that not exists. > This should trigger again a 404 response. >[5] Call unapi with format=marcxmlx&id=koha:biblionumber:[exist] > where exist should be a good biblionumber. > The wrong format should trigger a 406 response. >[6] Bonus: The 500 response can be tested by manipulating a XSLT file. > Create invalid xml in the file for marcxml (identity.xsl in intranet > xslt folder). > Call unapi with format=marcxml&id=koha:biblionumber:[exist]. > You should get a 500 response and have warnings in your logfile. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > opac/unapi | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > >diff --git a/opac/unapi b/opac/unapi >index d06fa44..b608210 100755 >--- a/opac/unapi >+++ b/opac/unapi >@@ -129,7 +129,7 @@ if (not defined $format) { > my $biblionumber = $1; > > my $content; >- eval { >+ > my $marcxml = GetXmlBiblio($biblionumber); > unless (defined $marcxml) { > # no bib, so 404 >@@ -147,9 +147,9 @@ if (not defined $format) { > xml => $marcxml, > file => $xslt_file, > }); >- }; >- if ($@) { >- print $cgi->header( -status => '500 internal error ' . $@ ); >+ >+ if( !defined $content || $xslt_engine->err ) { >+ print $cgi->header( -status => '500 internal error' ); > exit 0; > } > >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19439
:
67872
|
67873
|
68157
|
68158
|
69623
|
69624
|
69625