agarbato / unicloud

Unison file sync web interface
MIT License
66 stars 5 forks source link

Error in web app when clicking on client that hasn't connected #17

Closed emil10001 closed 2 years ago

emil10001 commented 2 years ago

Error when clicking on a client that hasn't been seen by the server yet:

TypeError
TypeError: unsupported format string passed to NoneType.__format__

Traceback (most recent call last)
File "/usr/lib/python3.9/site-packages/flask/app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "/usr/lib/python3.9/site-packages/flask_restful/__init__.py", line 271, in error_router
return original_handler(e)
File "/usr/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python3.9/site-packages/flask_restful/__init__.py", line 271, in error_router
return original_handler(e)Open an interactive python shell in this frame
File "/usr/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "/usr/lib/python3.9/site-packages/flask_basicauth.py", line 108, in wrapper
return view_func(*args, **kwargs)
File "/usr/local/unicloud/routes.py", line 202, in client_info_ui
status = cl.info()
File "/usr/local/unicloud/client_mgt.py", line 45, in info
'threshold': threshold[0][0], 'avg_duration': float("{0:.2f}".format(avg_duration[0][0]))})
TypeError: unsupported format string passed to NoneType.__format__
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
agarbato commented 2 years ago

This is fixed now thanks for reporting.. Image updated.
docker-compose pull to get the fix. Thanks