diff --git a/collects/web-server/dispatchers/dispatch-files.ss b/collects/web-server/dispatchers/dispatch-files.ss index 923d1b01a9..6823806b1c 100644 --- a/collects/web-server/dispatchers/dispatch-files.ss +++ b/collects/web-server/dispatchers/dispatch-files.ss @@ -12,11 +12,6 @@ [interface-version dispatcher-interface-version?]) (provide make) - ;; looks-like-directory : str -> bool - ;; to determine if is url style path looks like it refers to a directory - (define (looks-like-directory? path) - (eq? #\/ (string-ref path (sub1 (string-length path))))) - (define interface-version 'v1) (define/kw (make #:key url->path @@ -51,8 +46,7 @@ r) (output-file conn path method (path->mime-type path) 0 +inf.0)])])] - [(and (directory-exists? path) - (looks-like-directory? (url-path->string (url-path uri)))) + [(and (directory-exists? path)) (let/ec esc (for-each (lambda (dir-default) (define full-name (build-path path dir-default)) diff --git a/collects/web-server/tests/dispatchers/dispatch-files-test.ss b/collects/web-server/tests/dispatchers/dispatch-files-test.ss index 11a77f97d8..304eca3898 100644 --- a/collects/web-server/tests/dispatchers/dispatch-files-test.ss +++ b/collects/web-server/tests/dispatchers/dispatch-files-test.ss @@ -63,9 +63,9 @@ (test-equal? "dir, exists, head" (collect (dispatch #t a-dir) (req #t 'head empty)) #"HTTP/1.1 206 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: PLT Scheme\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: 81\r\nContent-Range: bytes 0-81/81\r\n\r\n") - (test-exn "dir, not dir-url, get" - exn:dispatcher? - (lambda () (collect (dispatch #t a-dir) (req #f 'get empty)))) + (test-equal? "dir, not dir-url, get" + (collect (dispatch #t a-dir) (req #f 'get empty)) + #"HTTP/1.1 206 Okay\r\nDate: REDACTED GMT\r\nLast-Modified: REDACTED GMT\r\nServer: PLT Scheme\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: 81\r\nContent-Range: bytes 0-81/81\r\n\r\nA titleHere's some content!") (test-exn "dir, not exists, get" exn:dispatcher? (lambda () (collect (dispatch #f a-dir) (req #t 'get empty))))