From d8a3fae361223c39244d8abde368d0877cf24652 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 9 May 2018 11:51:20 +0000 Subject: [PATCH] Bug 20737: Use https for baker and taylor cover images Easy change, should be able to verify with code review or testing with dummy values To test: 1 - Put some values in baker and taylor prefs (don't need to be valid) 2 - Do a search on the opac (and have some items with isbns) 3 - Inspect the cover images links to ensure they are formed correctly 4 - prove -v t/External/BakerTaylor.t Signed-off-by: Katrin Fischer Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- C4/External/BakerTaylor.pm | 6 +++--- opac/opac-detail.pl | 2 +- t/External/BakerTaylor.t | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/C4/External/BakerTaylor.pm b/C4/External/BakerTaylor.pm index 99d4dd5b70..dbb307cab9 100644 --- a/C4/External/BakerTaylor.pm +++ b/C4/External/BakerTaylor.pm @@ -44,7 +44,7 @@ sub _initialize { $user = (@_ ? shift : C4::Context->preference('BakerTaylorUsername') ) || ''; # LL17984 $pass = (@_ ? shift : C4::Context->preference('BakerTaylorPassword') ) || ''; # CC82349 $link_url = (@_ ? shift : C4::Context->preference('BakerTaylorBookstoreURL')); - $image_url = "http://contentcafe2.btol.com/ContentCafe/Jacket.aspx?UserID=$user&Password=$pass&Options=Y&Return=T&Type=S&Value="; + $image_url = "https://contentcafe2.btol.com/ContentCafe/Jacket.aspx?UserID=$user&Password=$pass&Options=Y&Return=T&Type=S&Value="; $agent = "Koha/$VERSION [en] (Linux)"; #"Mozilla/4.76 [en] (Win98; U)", # if for some reason you want to go stealth, you might prefer this } @@ -70,7 +70,7 @@ sub content_cafe_url { ($user and $pass) or return; my $isbn = (@_ ? shift : ''); $isbn =~ s/(p|-)//g; # sanitize - return "http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=$user&Password=$pass&Options=Y&ItemKey=$isbn"; + return "https://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=$user&Password=$pass&Options=Y&ItemKey=$isbn"; } sub http_jacket_link { @@ -90,7 +90,7 @@ sub availability { my $isbn = shift or return; ($user and $pass) or return; $isbn =~ s/(p|-)//g; # sanitize - my $url = "http://contentcafe2.btol.com/ContentCafe/InventoryAvailability.asmx/CheckInventory?UserID=$user&Password=$pass&Value=$isbn"; + my $url = "https://contentcafe2.btol.com/ContentCafe/InventoryAvailability.asmx/CheckInventory?UserID=$user&Password=$pass&Value=$isbn"; $debug and warn __PACKAGE__ . " request:\n$url\n"; my $content = get($url); $debug and print STDERR $content, "\n"; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 1fad0ab5f4..2c61b369f9 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -1081,7 +1081,7 @@ if (C4::Context->preference("BakerTaylorEnabled")) { { $template->param( BakerTaylorContentURL => - sprintf("http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=%s&Password=%s&ItemKey=%s&Options=Y", + sprintf("https://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=%s&Password=%s&ItemKey=%s&Options=Y", $bt_user,$bt_pass,$isbn) ); } diff --git a/t/External/BakerTaylor.t b/t/External/BakerTaylor.t index cbaa56e273..f6ceb2aa50 100755 --- a/t/External/BakerTaylor.t +++ b/t/External/BakerTaylor.t @@ -20,8 +20,8 @@ t::lib::Mocks::mock_preference( 'BakerTaylorUsername', $username ); t::lib::Mocks::mock_preference( 'BakerTaylorPassword', $password ); t::lib::Mocks::mock_preference( 'BakerTaylorBookstoreURL', $link_url ); -my $image_url = "http://contentcafe2.btol.com/ContentCafe/Jacket.aspx?UserID=$username&Password=$password&Options=Y&Return=T&Type=S&Value="; -my $content_cafe = "http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=$username&Password=$password&Options=Y&ItemKey="; +my $image_url = "https://contentcafe2.btol.com/ContentCafe/Jacket.aspx?UserID=$username&Password=$password&Options=Y&Return=T&Type=S&Value="; +my $content_cafe = "https://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=$username&Password=$password&Options=Y&ItemKey="; is( C4::External::BakerTaylor::image_url(), $image_url, "testing default image url"); is( C4::External::BakerTaylor::image_url("aa"), $image_url."aa", "testing image url construction"); -- 2.39.5