mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
static handler: add default 'application/octet-stream' and only set
guessed mime if not none
This commit is contained in:
parent
c996e70a6e
commit
ea89702701
@ -40,7 +40,7 @@ class SearchPageWbUrlHandler(WbUrlHandler):
|
|||||||
create_template(html, 'Frame Insert'))
|
create_template(html, 'Frame Insert'))
|
||||||
|
|
||||||
self.banner_html = config.get('banner_html', 'banner.html')
|
self.banner_html = config.get('banner_html', 'banner.html')
|
||||||
|
|
||||||
if config.get('enable_memento', False):
|
if config.get('enable_memento', False):
|
||||||
self.response_class = MementoResponse
|
self.response_class = MementoResponse
|
||||||
|
|
||||||
@ -193,7 +193,11 @@ class StaticHandler(BaseHandler):
|
|||||||
else:
|
else:
|
||||||
reader = iter(lambda: data.read(), '')
|
reader = iter(lambda: data.read(), '')
|
||||||
|
|
||||||
content_type, _ = mimetypes.guess_type(full_path)
|
content_type = 'application/octet-stream'
|
||||||
|
|
||||||
|
guessed = mimetypes.guess_type(full_path)
|
||||||
|
if guessed[0]:
|
||||||
|
content_type = guessed[0]
|
||||||
|
|
||||||
return WbResponse.text_stream(data,
|
return WbResponse.text_stream(data,
|
||||||
content_type=content_type,
|
content_type=content_type,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user