[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/01: upstream: Reject bogus archive type guesses.
From: |
Ludovic Courtès |
Subject: |
01/01: upstream: Reject bogus archive type guesses. |
Date: |
Tue, 19 Dec 2017 12:16:52 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit 618f0582b49edb0a5f633c953b00fc93d03c077a
Author: Ludovic Courtès <address@hidden>
Date: Tue Dec 19 17:57:15 2017 +0100
upstream: Reject bogus archive type guesses.
This would crash 'guix refresh -u' with source URLs ending in
"…/v1.2.3".
* guix/upstream.scm (package-update): Be stricter when determining
ARCHIVE-TYPE.
---
guix/upstream.scm | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/guix/upstream.scm b/guix/upstream.scm
index 0fe3308..caaa0e4 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -278,7 +278,13 @@ and 'interactive' (default)."
((archive-type)
(match (and=> (package-source package) origin-uri)
((? string? uri)
- (file-extension (basename uri)))
+ (let ((type (file-extension (basename uri))))
+ ;; Sometimes we have URLs such as
+ ;; "https://github.com/…/tarball/v0.1", in which case
+ ;; we must not consider "1" as the extension.
+ (and (or (string-contains type "z")
+ (string=? type "tar"))
+ type)))
(_
"gz")))
((url signature-url)