From acc7da6a5f93e12704acdfd7981481c9ef07904b Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 2 Sep 2014 09:14:03 +0000 Subject: [PATCH] Bug 12858: Add error handling to Syndetics Index * Syndetics routines include a statement to check that the returned content from Syndetics is xml. The get_syndetics_index routine was missing this check and so when a 'not found' html page was returned the opac-detail page would take a long time to load whilst xml::simple attempted to parse the large html document. Test Plan 1. Enable Syndetics indexes on opac. 2. Head over to an opac-detail page on the opac. 3. Remove the ISBN from the same item in the staff client. 4. Reload the opac-detail page for the item noticeing a much slower page load. 5. Apply the patch 6. Reload the opac-detail page for the item and note that it now laods in a reasonable timescale again. Signed-off-by: Chris Cormack Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- C4/External/Syndetics.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/C4/External/Syndetics.pm b/C4/External/Syndetics.pm index 3d518daa13..2d14674caa 100644 --- a/C4/External/Syndetics.pm +++ b/C4/External/Syndetics.pm @@ -66,6 +66,9 @@ sub get_syndetics_index { my ( $isbn,$upc,$oclc ) = @_; my $response = _fetch_syndetics_content('INDEX.XML', $isbn, $upc, $oclc); + unless ($response->content_type =~ /xml/) { + return; + } my $content = $response->content; my $xmlsimple = XML::Simple->new(); -- 2.39.5