From: Ian Jackson Date: Mon, 10 Aug 2020 16:11:59 +0000 (+0100) Subject: history reporting (nfc): Break out url_quote X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=cc93afddc5dfa41fe3e005b9c8921633a0b54023;p=osstest.git history reporting (nfc): Break out url_quote Signed-off-by: Ian Jackson --- diff --git a/Osstest/HistoryReport.pm b/Osstest/HistoryReport.pm index bfbee28..f30ded5 100644 --- a/Osstest/HistoryReport.pm +++ b/Osstest/HistoryReport.pm @@ -156,6 +156,12 @@ sub cache_read_previous ($) { close H; } +sub url_quote ($) { + local ($_) = "$_[0]"; + s{[^-+=/~:;_.,\w]}{ sprintf "%%%02x", ord $& }ge; + $_; +} + sub cache_row_lookup_prep ($) { my ($jrr) = @_; @@ -179,8 +185,7 @@ sub cache_write_entry ($$) { next if $k =~ m/^\%/; $_ = $h->{$k}; next unless defined; - s{[^-+=/~:;_.,\w]}{ sprintf "%%%02x", ord $& }ge; - printf $fh " %s=%s", $k, $_; + printf $fh " %s=%s", $k, url_quote($_); } }; $whash->($jr);