Skip to content

Commit

Permalink
Fix KeyError when serving static files (#1648)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheng5 authored Aug 27, 2024
1 parent 769b36b commit d6d8710
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shiny/http_staticfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def file_response(
**kwargs: Any,
) -> starlette.responses.Response:
resp = super().file_response(full_path, *args, **kwargs)
if resp.headers["content-type"].startswith("text/plain"):
if resp.headers.get("content-type", "").startswith("text/plain"):
correct_type = _utils.guess_mime_type(full_path)
resp.headers["content-type"] = (
f"{correct_type}; charset={resp.charset}"
Expand Down

0 comments on commit d6d8710

Please sign in to comment.