Skip to content

Commit

Permalink
Merge pull request #105 from hhaensel/master
Browse files Browse the repository at this point in the history
support assetserving of files with spaces
  • Loading branch information
cmcaine authored Sep 5, 2023
2 parents 816fde7 + 178b167 commit e8e1bf9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/examples/files.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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())

0 comments on commit e8e1bf9

Please sign in to comment.