[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/03: substitute: Gracefully handle trailing slashes in URLs.
From: |
Ludovic Courtès |
Subject: |
01/03: substitute: Gracefully handle trailing slashes in URLs. |
Date: |
Thu, 14 Jul 2016 17:07:44 +0000 (UTC) |
civodul pushed a commit to branch master
in repository guix.
commit a7a3b390600351014bee523cadb25c9a242064e9
Author: Ludovic Courtès <address@hidden>
Date: Thu Jul 14 15:19:07 2016 +0200
substitute: Gracefully handle trailing slashes in URLs.
Previously, using something like
"--substitute-urls=http://example.org///" would lead to a
'cache-narinfo!' call with #f as its second argument.
It would also do the wrong thing for URLs with a non-empty initial path
component, such as "http://example.org/foo/bar".
* guix/scripts/substitute.scm (fetch-narinfos)[handle-narinfo-response]:
Add call to 'basename' for PATH.
---
guix/scripts/substitute.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 5722aa8..8827c45 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -610,7 +610,8 @@ if file doesn't exist, and the narinfo otherwise."
(update-progress!)
(cons narinfo result))
(let* ((path (uri-path (request-uri request)))
- (hash-part (string-drop-right path 8))) ; drop ".narinfo"
+ (hash-part (basename
+ (string-drop-right path 8)))) ;drop ".narinfo"
(if len
(get-bytevector-n port len)
(read-to-eof port))