From a9cfc5d0ef1a8cdb015830286f81d53fba67ecc0 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 30 Sep 2013 15:47:03 +1000 Subject: [PATCH] [PASSED QA] Bug 10974 - OAI-PMH Resumption Tokens Do Not Handle Time This patch changes the value separator in OAI-PMH resumption tokens from colons to slashes, so that the token string isn't split incorrectly when a time is included. TEST PLAN: 1) Turn on the OAI-PMH server syspref in Koha 2) Send a ListRecords request using 'from' and 'until' arguments that include times (Best to use very far apart times so that you retrieve more than 50 records which will likely be the trigger for a resumptionToken). Here is an example: http://KOHAINSTANCE/cgi-bin/koha/oai.pl?verb=ListRecords& metadataPrefix=oai_dc&from=2012-09-05T13:44:33Z&until=2014-09-05T13:44:33Z N.B. Replace KOHAINSTANCE with the URL of your Koha instance. 3) Scroll down to the bottom of the page until you find the resumptionToken. It will look similar to this: oai_dc:50:2012-09-05T13:44:33Z:2014-09-05T13:44:33Z: 4) Copy that resumption token and send a request with it like so: http://KOHAINSTANCE/cgi-bin/koha/oai.pl?verb=ListRecords& resumptionToken=oai_dc:50:2012-09-05T13:44:33Z:2014-09-05T13:44:33Z: 5) The page should (incorrectly) show no records. 6) APPLY PATCH 7) Repeat steps 2, 3, and 4 8) Note that the resumptionToken now uses slashes (e.g. /) instead of colons. Note also that now the second request will show records!!! N.B. This will only happen if Koha has enough records to serve to you. If your Koha has less than 50 records, try lowering the number provided in the "OAI-PMH:MaxCount" system preference. Signed-off-by: Petter Goksoyr Asen I understand; I can now confirm the behaviour described in the test plan. Signed-off-by: Katrin Fischer Passes test plan, all tests and QA script. Resumption Token works correctly after applying the patch. --- opac/oai.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opac/oai.pl b/opac/oai.pl index 7aa5a7d..b453408 100755 --- a/opac/oai.pl +++ b/opac/oai.pl @@ -89,7 +89,7 @@ sub new { my ($metadata_prefix, $offset, $from, $until, $set); if ( $args{ resumptionToken } ) { ($metadata_prefix, $offset, $from, $until, $set) - = split( ':', $args{resumptionToken} ); + = split( '/', $args{resumptionToken} ); } else { $metadata_prefix = $args{ metadataPrefix }; @@ -110,7 +110,7 @@ sub new { $self->{ set } = $set; $self->resumptionToken( - join( ':', $metadata_prefix, $offset, $from, $until, $set ) ); + join( '/', $metadata_prefix, $offset, $from, $until, $set ) ); $self->cursor( $offset ); return $self; -- 1.7.9.5