-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
static_file is serving gzipped files as uncompressed #1350
Comments
The file is not decompressed by bottle, but if the file-name looks stream-compressed (e.g. |
Hi @defnull, thanks for the quick answer and explanation.
Indeed
To be able to serve gzip and non-gzip files in the same route without from bottle import route, run, static_file
import mimetypes
@route("/static/<filename:path>")
def send_static(filename):
mimetype = mimetypes.guess_type(filepath)
return static_file(filename, root=".", mimetype=mimetype) Do you think it could make sense to add a new param to |
Hmm the more I think about it, the more I'd say this is a bug in Bottle, not just a misguided feature. Not sure how to fix this in a backwards compatible way, though. That's something for the next release. The idea would be to disable the flawed |
Do not instruct browsers to transparently uncompress gzipped files.
Do not instruct browsers to transparently uncompress gzipped files.
When using
static_file
withoutmimetype
to serve a file compressed with gzip, bottle seems to uncompress it on the fly.How to reproduce it:
mimetype
:The text was updated successfully, but these errors were encountered: