secedu/flask-core

exception in serving non-utf8 static files

Closed this issue · 1 comments

asp-frontend_1  | [2019-04-03 01:55:31,242] ERROR in app: Exception on /assets/api_management_hero.png [GET]
asp-frontend_1  | Traceback (most recent call last):
asp-frontend_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app
asp-frontend_1  |     response = self.full_dispatch_request()
asp-frontend_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1816, in full_dispatch_request
asp-frontend_1  |     return self.finalize_request(rv)
asp-frontend_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1833, in finalize_request
asp-frontend_1  |     response = self.process_response(response)
asp-frontend_1  |   File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2112, in process_response
asp-frontend_1  |     response = handler(response)
asp-frontend_1  |   File "/usr/local/lib/python3.7/site-packages/flask_core/flag/__init__.py", line 31, in grep_flag
asp-frontend_1  |     data = str(response.get_data(), "utf-8")
asp-frontend_1  | UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
asp-frontend_1  | 129.94.8.170 - - [03/Apr/2019 01:55:31] "GET /assets/api_management_hero.png HTTP/1.1" 500 -
cry commented

@zainafzal08 you need to handle these files correctly.

@adamyi I suggest enabling sendfile in your webserver and flask to see if you can bypass this issue