Skip to content

Commit d6d8710

Browse files
authored
Fix KeyError when serving static files (#1648)
1 parent 769b36b commit d6d8710

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

shiny/http_staticfiles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def file_response(
4343
**kwargs: Any,
4444
) -> starlette.responses.Response:
4545
resp = super().file_response(full_path, *args, **kwargs)
46-
if resp.headers["content-type"].startswith("text/plain"):
46+
if resp.headers.get("content-type", "").startswith("text/plain"):
4747
correct_type = _utils.guess_mime_type(full_path)
4848
resp.headers["content-type"] = (
4949
f"{correct_type}; charset={resp.charset}"

0 commit comments

Comments
 (0)