summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--henrietta-cache.scm13
1 files changed, 10 insertions, 3 deletions
diff --git a/henrietta-cache.scm b/henrietta-cache.scm
index 2f1c7cf..3a67189 100644
--- a/henrietta-cache.scm
+++ b/henrietta-cache.scm
@@ -1,4 +1,4 @@
-(use utils posix http-client matchable uri-common)
+(use utils posix http-client matchable uri-common srfi-1)
(define (usage code)
(print #<#EOF
@@ -128,8 +128,15 @@ EOF
(let ((lines (call-with-input-request uri #f read-lines)))
(when (null? lines)
(error "Empty files-list file" uri))
- (download-files-from-list (uri-reference (car lines))
- (cdr lines) cache-dir))
+ (let* ((original-uri (uri-reference (car lines)))
+ (path (uri-path original-uri))
+ ;; Ensure base URI is seen as a directory so relative refs
+ ;; are always appended
+ (base-uri (update-uri original-uri
+ path: (if (string=? "" (last path))
+ path
+ `(,@path "")))))
+ (download-files-from-list base-uri (cdr lines) cache-dir)))
(e (exn http)
(error (sprintf "Could not download files-list \"~A\" -- ~A\n"
uri (get-condition-property e 'exn 'message))))))