mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Server: actually return MIME type
The original paths being provided had a tailing slash, and so everything was returning as "application/octet-stream" (at least on Windows)
This commit is contained in:
parent
f862d64b7a
commit
1b52185ece
1 changed files with 3 additions and 1 deletions
|
|
@ -91,7 +91,9 @@ class ComplexHTTPRequestHandler(server.SimpleHTTPRequestHandler):
|
|||
def guess_type(self, path):
|
||||
"""Guess at the mime type for the specified file.
|
||||
"""
|
||||
mimetype = server.SimpleHTTPRequestHandler.guess_type(self, path)
|
||||
# strip trailing slash
|
||||
path = path.rstrip().strip("/").strip(os.sep)
|
||||
mimetype = super().guess_type(path)
|
||||
|
||||
# If the default guess is too generic, try the python-magic library
|
||||
if mimetype == 'application/octet-stream' and magic_from_file:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue