From 551b0ab65ce8f34db142f72ccb7a4e0a42518dd1 Mon Sep 17 00:00:00 2001
From: Bill Erickson <berick@esilibrary.com>
Date: Tue, 15 May 2012 10:11:37 -0400
Subject: [PATCH] TPAC added content data retrieval sanity check

On the backend, avoid fetching added content data when initial request
returns 404.  This prevents edge case where a specific type may be
selected (e.g. via bookmark) even though no data exists for the type.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
---
 Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
index f7d09f6eaa..0a3935b92f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
@@ -472,7 +472,7 @@ sub added_content_stage2 {
                 $content->{status} = $code eq '200' ? 1 : 2;
                 $logger->debug("tpac: added content request for $type returned $code");
 
-                if ($type eq $sel_type) {
+                if ($code eq '200' and $type eq $sel_type) {
                     while (1) {
                         my $buf;
                         my $n = $req->read_entity_body($buf, 1024);
-- 
2.11.0