From a7d132ff2a9473031c911e8841c59dcba88e1e3a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 9 Feb 2010 16:11:35 +0000 Subject: [PATCH] * Escape `+', `=' and `?' in NAR URIS in manifests. Otherwise you get an incorrect URI that gives a 410 error. --- src/lib/Hydra/View/NixManifest.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib/Hydra/View/NixManifest.pm b/src/lib/Hydra/View/NixManifest.pm index 6e8afae0..e040604e 100644 --- a/src/lib/Hydra/View/NixManifest.pm +++ b/src/lib/Hydra/View/NixManifest.pm @@ -22,8 +22,15 @@ sub process { foreach my $path (@paths) { my ($hash, $deriver, $refs) = queryPathInfo $path; + + # Escape the characters that are allowed to appear in a Nix + # path name but have special meaning in a URI. + my $escaped = $path; + $escaped =~ s/\+/%2b/g; + $escaped =~ s/\=/%3d/g; + $escaped =~ s/\?/%3f/g; - my $url = $c->stash->{narBase} . $path; + my $url = $c->stash->{narBase} . $escaped; $manifest .= "{\n" .