OxygenFramework / Oxygen.jl

💨 A breath of fresh air for programming web apps in Julia
https://oxygenframework.github.io/Oxygen.jl/
MIT License
383 stars 25 forks source link

KeyError: key "map" not found #105

Closed sschmidhuber closed 1 year ago

sschmidhuber commented 1 year ago

Hello @ndortega, I came across an issue with serving static and dynamic files. If the mime type of a file is not identified correctly, Oxygen fails with the error message: KeyError: key "map" not found The issue seems to be in the function mimetype(filename::String) of mimetypes.jl. The file to lookup mime types doesn't contain e.g. *.map files which are widely used when loading JS libraries.

I noticed that https://github.com/JuliaWeb/MIMEs.jl has a more comprehensive list to map extensions to MIME types. Maybe instead of maintaining a separate list, it is easier to use MIMEs for that.

Also if the MIME can't be identified a fallback solution would be good instead of failing with an error.

BR Stefan

ndortega commented 1 year ago

Hi @sschmidhuber ,

Thanks for opening this issue. I agree, It'd be a much better option to utilize the same mime database.