Commits

Peter Bex committed f99f1af

Update to ensure path is always taken as a dir

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))))))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.