Commits

Peter Bex committed f99f1af

Update to ensure path is always taken as a dir

  • Participants
  • Parent commits a6ecd3a

Comments (0)

Files changed (1)

henrietta-cache.scm

-(use utils posix http-client matchable uri-common)
+(use utils posix http-client matchable uri-common srfi-1)
 
 (define (usage code)
   (print #<#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))))))