From 02a209c7df11c7c53166499ed3caf630c3d8e7f9 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Thu, 2 Jun 2011 16:05:02 +0200 Subject: Update to ensure path is always taken as a dir --- henrietta-cache.scm | 13 ++++++++++--- 1 file 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)))))) -- cgit v1.2.3