From 178b167ce154d1d615cd3e3837cf1c816ccaaf3d Mon Sep 17 00:00:00 2001 From: Helmut Haensel Date: Wed, 10 Jun 2020 16:57:33 +0200 Subject: [PATCH] support assetserving of files with spaces --- src/examples/files.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/examples/files.jl b/src/examples/files.jl index 9020224b..611bc195 100644 --- a/src/examples/files.jl +++ b/src/examples/files.jl @@ -77,10 +77,11 @@ const pkgfiles = route("pkg/:pkg", packagefiles(), Mux.notfound()) using AssetRegistry function assetserve(dirs=true) - absdir(req) = AssetRegistry.registry["/assetserver/" * req[:params][:key]] + absdir(req) = AssetRegistry.registry["/assetserver/" * HTTP.unescapeuri(req[:params][:key])] + path(req) = HTTP.unescapeuri.(req[:path]) branch(req -> (isfile(absdir(req)) && isempty(req[:path])) || - validpath(absdir(req), joinpath(req[:path]...), dirs=dirs), - req -> fresp(joinpath(absdir(req), req[:path]...))) + validpath(absdir(req), joinpath(path(req)...), dirs=dirs), + req -> fresp(joinpath(absdir(req), path(req)...))) end const assetserver = route("assetserver/:key", assetserve(), Mux.notfound())