FAI-CIVL / FAI-Airscore

AirScore - online paragliding / hanggliding GAP-based scoring software.
https://airscore.cc/
GNU General Public License v3.0
13 stars 17 forks source link

Bulk import tracks from empty zip file. #216

Closed philderbeast closed 3 years ago

philderbeast commented 3 years ago

I have all the tracks for the HG Worlds 2019 except for the training day. I thought I'd have a go at bulk importing tracks for that day anyway. It's an empty zip file.

POST http://localhost:5000/users/_upload_track_zip/22 500 (INTERNAL SERVER ERROR)
Traceback (most recent call last):
  File "/home/sid/.local/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/sid/.local/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app
    response = self.handle_exception(e)
  File "/home/sid/.local/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/sid/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/sid/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/sid/.local/lib/python3.8/site-packages/flask/app.py", line 1953, in full_dispatch_request
    return self.finalize_request(rv)
  File "/home/sid/.local/lib/python3.8/site-packages/flask/app.py", line 1968, in finalize_request
    response = self.make_response(rv)
  File "/home/sid/.local/lib/python3.8/site-packages/flask/app.py", line 2097, in make_response
    raise TypeError(
TypeError: The view function did not return a valid response.
The function either returned None or ended without a return statement.
biuti commented 3 years ago

I couldn't reproduce, anyway I added a check for zip file validity, and also will be processed only if contains files with given extensions list (https://github.com/FAI-CIVL/FAI-Airscore/commit/2d79b6517c7a9985f258861bbb700b59e05d2e63). Now it gives feedback about errors in flashed messages (no file, no zip file, empty file, corrupted file).

@philderbeast please test with your empty zip file.