Bug 20097 - marc2dcxml croaks on format dc
Summary: marc2dcxml croaks on format dc
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Marcel de Rooy
QA Contact: Josef Moravec
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-29 09:31 UTC by Marcel de Rooy
Modified: 2018-06-04 20:15 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 20097: Use same regex in marc2dcxml and opac-export (1.88 KB, patch)
2018-01-29 09:38 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 20097: Follow-up with a unit test (1.63 KB, patch)
2018-03-08 03:05 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 20097: Use same regex in marc2dcxml and opac-export (1.89 KB, patch)
2018-03-08 03:13 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 20097: Follow-up with a unit test (1.68 KB, patch)
2018-03-08 03:13 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 20097: Use same regex in marc2dcxml and opac-export (1.95 KB, patch)
2018-03-08 13:04 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 20097: Follow-up with a unit test (1.74 KB, patch)
2018-03-08 13:04 UTC, Josef Moravec
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2018-01-29 09:31:57 UTC
Format 'dc' could be accepted by C4::Record::marc2dcxml since there is a xslt.
I saw this error in my log:
The format argument (dc) not accepted.
Please pass a valid format (oaidc, srwdc, or rdfdc)
 at opac/opac-export.pl line 80.
[Probably from Googlebot or so.]

I would prefer to see 'Format not supported' rather than 'Internal server error'.
We can achieve that by using the same regex in opac-export.pl and Record.pm.
Note that I skip catalogue/export.pl here, since it has no fallback at the end, and will not be called by bots.
Comment 1 Marcel de Rooy 2018-01-29 09:38:25 UTC
Created attachment 71018 [details] [review]
Bug 20097: Use same regex in marc2dcxml and opac-export

This regex allows: dc, oaidc, srwdc, and rdfdc.

Test plan:
[1] Check https://[yourserver]/cgi-bin/koha/opac-export.pl?bib=[some_biblionumber]&op=export&format=dc
[2] Check https://[yourserver]/cgi-bin/koha/opac-export.pl?bib=[some_biblionumber]&op=export&format=oaidc
[3] Check https://[yourserver]/cgi-bin/koha/opac-export.pl?bib=[some_biblionumber]&op=export&format=nodc. This one should trigger a not-supported message.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Maksim Sen 2018-03-02 20:20:00 UTC
Hey Marcel,

When I tried to get to the links you put out, I got to an Error 404 in Koha (after changing the server and bibnumbers of course), with and without the patch.

I accessed the links directly, do I need to access your through another page?
Comment 3 Marcel de Rooy 2018-03-05 11:02:28 UTC
(In reply to Maksim Sen from comment #2)
> Hey Marcel,
> 
> When I tried to get to the links you put out, I got to an Error 404 in Koha
> (after changing the server and bibnumbers of course), with and without the
> patch.
> 
> I accessed the links directly, do I need to access your through another page?

Thx for testing, Maksim.
Testing these links should be enough. They still work for me.
Please paste the URL you tried.
Comment 4 M. Tompsett 2018-03-08 03:05:05 UTC
Created attachment 72528 [details] [review]
Bug 20097: Follow-up with a unit test

kshell
prove -v t/db_dependent/Record.t
Comment 5 M. Tompsett 2018-03-08 03:11:20 UTC
I tested these on a reset_all, kohadevbox.
localhost:8080/cgi-bin/koha/opac-export.pl?bib=1&op=export&format=dc
localhost:8080/cgi-bin/koha/opac-export.pl?bib=1&op=export&format=oaidc
localhost:8080/cgi-bin/koha/opac-export.pl?bib=1&op=export&format=srwdc
localhost:8080/cgi-bin/koha/opac-export.pl?bib=1&op=export&format=rdfdc
localhost:8080/cgi-bin/koha/opac-export.pl?bib=1&op=export&format=nodc
Comment 6 M. Tompsett 2018-03-08 03:13:07 UTC
Created attachment 72529 [details] [review]
Bug 20097: Use same regex in marc2dcxml and opac-export

This regex allows: dc, oaidc, srwdc, and rdfdc.

Test plan:
[1] Check https://[yourserver]/cgi-bin/koha/opac-export.pl?bib=[some_biblionumber]&op=export&format=dc
[2] Check https://[yourserver]/cgi-bin/koha/opac-export.pl?bib=[some_biblionumber]&op=export&format=oaidc
[3] Check https://[yourserver]/cgi-bin/koha/opac-export.pl?bib=[some_biblionumber]&op=export&format=nodc. This one should trigger a not-supported message.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 7 M. Tompsett 2018-03-08 03:13:10 UTC
Created attachment 72530 [details] [review]
Bug 20097: Follow-up with a unit test

kshell
prove -v t/db_dependent/Record.t

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 8 Josef Moravec 2018-03-08 13:04:49 UTC
Created attachment 72537 [details] [review]
Bug 20097: Use same regex in marc2dcxml and opac-export

This regex allows: dc, oaidc, srwdc, and rdfdc.

Test plan:
[1] Check https://[yourserver]/cgi-bin/koha/opac-export.pl?bib=[some_biblionumber]&op=export&format=dc
[2] Check https://[yourserver]/cgi-bin/koha/opac-export.pl?bib=[some_biblionumber]&op=export&format=oaidc
[3] Check https://[yourserver]/cgi-bin/koha/opac-export.pl?bib=[some_biblionumber]&op=export&format=nodc. This one should trigger a not-supported message.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 9 Josef Moravec 2018-03-08 13:04:53 UTC
Created attachment 72538 [details] [review]
Bug 20097: Follow-up with a unit test

kshell
prove -v t/db_dependent/Record.t

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 10 Jonathan Druart 2018-03-19 18:30:59 UTC
Pushed to master for 18.05, thanks to everybody involved!