better unicode handling - fixes #347, i think

This commit is contained in:
Rich Harris
2018-09-02 23:00:39 -04:00
parent 8b60d568dc
commit 6ccae0cd33
3 changed files with 22 additions and 2 deletions

View File

@@ -185,7 +185,8 @@ function serve({ prefix, pathname, cache_control }: {
const type = lookup(req.path);
try {
const data = read(req.path.slice(1));
const file = decodeURIComponent(req.path.slice(1));
const data = read(file);
res.setHeader('Content-Type', type);
res.setHeader('Cache-Control', cache_control);