Closed t-i-r closed 4 years ago
Hi,
The add_icon_rule
method enable to display the icon choose for extension OR mimetype. It does not set the mimetype
To do this you need to force the Content-Type
header with Flask
like
resp = make_response(idx.render_autoindex('.'))
resp.headers['Content-Type'] = 'text/plain'
return resp
Hi -
I would like to set MIME for e.g. yaml documents to text/plain so that yaml files can be directly viewed in the web browser rather than downloaded.
I tried e.g.
idx.add_icon_rule('my_yaml_icon.png', ext='yaml', mimetype='text/plain')
but the response header returned by flask still defaults to application/octet-stream. Can you please share example how to properly set mime based on file extension?
Thank you, TIR