From 832bb1816262eb77eff269c2e0e8a9670eed998c Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 18 Jun 2021 19:40:44 +0000 Subject: [PATCH] Bug 28603: Encode spaces in urls in url checker To test: 1 - Add a url to a record like: http://localhost:8081/cgi-bin/koha/catalogue/search.pl?idx=ti&q=street%20shuffle 2 - perl misc/cronjobs/check-url-quick.pl -v > test.txt 3 - grep shuffle test.txt 4 - 303 http://localhost:8081/cgi-bin/koha/catalogue/search.pl?idx=ti&q=street shuffle 596 Connection timed out 5 - Apply patch 6 - perl misc/cronjobs/check-url-quick.pl -v > test.txt 7 - grep shuffle test.txt 8 - 303 http://localhost:8081/cgi-bin/koha/catalogue/search.pl?idx=ti&q=street%20shuffle 200 OK Signed-off-by: David Nind --- misc/cronjobs/check-url-quick.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/misc/cronjobs/check-url-quick.pl b/misc/cronjobs/check-url-quick.pl index 93fcd97a10..e214dc8180 100755 --- a/misc/cronjobs/check-url-quick.pl +++ b/misc/cronjobs/check-url-quick.pl @@ -27,6 +27,7 @@ use C4::Biblio; use AnyEvent; use AnyEvent::HTTP; use Encode; +use URI::Escape; my ( $verbose, $help, $html ) = ( 0, 0, 0 ); my ( $host, $host_intranet ) = ( '', '' ); @@ -100,6 +101,7 @@ sub check_all_url { next unless $url; $url = "$host/$url" unless $url =~ /^http/i; $url = encode_utf8($url); + $url = uri_escape( $url, " " ); $count++; http_request( HEAD => $url, -- 2.20.1