Skip to content

Commit

Permalink
Use mimetypes to get the asset encoding header
Browse files Browse the repository at this point in the history
  • Loading branch information
davegaeddert committed Aug 13, 2024
1 parent d867386 commit b74b810
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions plain/plain/assets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,8 @@ def update_headers(self, headers, path):
headers["Vary"] = vary + ", Accept-Encoding"

# If the file is compressed, tell the browser
if path.endswith(".gz"):
headers.setdefault("Content-Encoding", "gzip")
elif path.endswith(".br"):
headers.setdefault("Content-Encoding", "br")
if encoding := mimetypes.guess_type(path)[1]:
headers.setdefault("Content-Encoding", encoding)

is_immutable = self.is_immutable(path)

Expand Down

0 comments on commit b74b810

Please sign in to comment.