fix wrong encoding header from server
This commit is contained in:
parent
8d30892d23
commit
d43d44bf66
|
@ -417,8 +417,13 @@ class BServer:
|
||||||
|
|
||||||
type_, encoding = mimetypes.guess_type(filename)
|
type_, encoding = mimetypes.guess_type(filename)
|
||||||
if encoding is None:
|
if encoding is None:
|
||||||
encoding = "utf8"
|
encoding = "utf-8"
|
||||||
|
|
||||||
|
# Images do not have charset. Just bytes. Except text based svg.
|
||||||
|
# Todo: fallback if type_ is None?
|
||||||
|
if type_ is not None and "image" in type_ and type_ != "image/svg+xml":
|
||||||
|
start_response("200 OK", [('Content-type', "%s" % type_)])
|
||||||
|
else:
|
||||||
start_response("200 OK", [('Content-type', "%s; charset=%s" % (type_, encoding))])
|
start_response("200 OK", [('Content-type', "%s; charset=%s" % (type_, encoding))])
|
||||||
|
|
||||||
f = open(path, 'rb')
|
f = open(path, 'rb')
|
||||||
|
|
Loading…
Reference in New Issue