]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
make cgiurl output deterministic
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Tue, 19 May 2015 18:09:38 +0000 (14:09 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 19 May 2015 19:34:46 +0000 (15:34 -0400)
IkiWiki::cgiurl() currently produces non-deterministic output, because
the params hash can be sorted different ways.

Sorting keys to params before crafting the string should make the
output deterministic.

IkiWiki.pm

index bb36b0885e8c43ff0b913c850935d18d7cf81529..a70773506a7468bf6289d51d195845f9e0d3895d 100644 (file)
@@ -1217,7 +1217,7 @@ sub cgiurl (@) {
        }
 
        return $cgiurl."?".
-               join("&amp;", map $_."=".uri_escape_utf8($params{$_}), keys %params);
+               join("&amp;", map $_."=".uri_escape_utf8($params{$_}), sort(keys %params));
 }
 
 sub cgiurl_abs (@) {