From a732f3040bfcbfdc7c49f66e37f5688b51df3936 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 16 Jul 2015 09:16:46 -0400 Subject: [PATCH] Bug 14530 - 856$u URL checker ( check-url.pl ) complains about ftp based URLs The script check-url.pl assumes that any URL not prefixed with http must be a relative URL. This is problematic as the URL could be prefixed with ftp as well. Any 856$u using an ftp url is given the error "400 URL Must be absolute". Since HTTP::Request cannot handle ftp urls, we should just skip them. I also noticed that check-url-quick.pl checks for prefixes with case insensitivity. That seems like a good idea so I've added that to check-url.pl Test Plan: 1) Apply this patch 2) Find or create a record with an ftp url in 865$u 3) Run check-url.pl 4) Note the ftp url is skipped 5) Run check-url-quick.pl 6) Note the ftp url is skipped --- misc/cronjobs/check-url-quick.pl | 1 + misc/cronjobs/check-url.pl | 4 +++- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/misc/cronjobs/check-url-quick.pl b/misc/cronjobs/check-url-quick.pl index e599808..7671166 100755 --- a/misc/cronjobs/check-url-quick.pl +++ b/misc/cronjobs/check-url-quick.pl @@ -95,6 +95,7 @@ sub check_all_url { foreach my $field ( $record->field($tag) ) { my $url = $field->subfield('u'); next unless $url; + next if $url =~ /^ftp/i; $url = "$host/$url" unless $url =~ /^http/i; $count++; http_request( diff --git a/misc/cronjobs/check-url.pl b/misc/cronjobs/check-url.pl index 71885ab..064ad17 100755 --- a/misc/cronjobs/check-url.pl +++ b/misc/cronjobs/check-url.pl @@ -112,7 +112,9 @@ sub check_biblio { foreach my $field ( $record->field('856') ) { my $url = $field->subfield('u'); next unless $url; - $url = "$host/$url" unless $url =~ /^http/; + next if $url =~ /^ftp/i; + + $url = "$host/$url" unless $url =~ /^http/i; my $check = { url => $url }; if ( $bad_url->{ $url } ) { $check->{ is_success } = 1; -- 1.7.2.5