gnu-maintenance: Better handle empty #:directory for 'latest-html-release'.
authorLudovic Courtès <ludo@gnu.org>
Thu, 18 Mar 2021 14:15:44 +0000 (15:15 +0100)
committerLudovic Courtès <ludo@gnu.org>
Fri, 19 Mar 2021 12:23:26 +0000 (13:23 +0100)
In particular, this makes sure we don't add a trailing slash when the
user specified a 'release-monitoring-url' property for the
'generic-html' updater.

* guix/gnu-maintenance.scm (latest-html-release): When DIRECTORY is
empty, do not append it.

guix/gnu-maintenance.scm

index 4ba2a5f..d9c97be 100644 (file)
@@ -475,7 +475,9 @@ When FILE->SIGNATURE is omitted or #f, guess the detached signature file name,
 if any.  Otherwise, FILE->SIGNATURE must be a procedure; it is passed a source
 file URL and must return the corresponding signature URL, or #f it signatures
 are unavailable."
-  (let* ((uri   (string->uri (string-append base-url directory "/")))
+  (let* ((uri   (string->uri (if (string-null? directory)
+                                 base-url
+                                 (string-append base-url directory "/"))))
          (port  (http-fetch/cached uri #:ttl 3600))
          (sxml  (html->sxml port))
          (links (delete-duplicates (html-links sxml))))