diff mbox series

[OSSTEST,47/60] history reporting (nfc): Break out url_quote

Message ID 20200814172205.9624-48-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series Speed up sg-report-job-history | expand

Commit Message

Ian Jackson Aug. 14, 2020, 5:21 p.m. UTC
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/HistoryReport.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/Osstest/HistoryReport.pm b/Osstest/HistoryReport.pm
index bfbee28c..f30ded5b 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);