Flexget / webui

The FlexGet Web UI
MIT License
42 stars 19 forks source link

[BUG] Config cannot be saved with accent character in it. #85

Closed junpet closed 4 years ago

junpet commented 4 years ago

Expected behaviour:

Saves config with accent charactersk.

Actual behaviour:

The config won't be saved with accent characters in it.

Steps to reproduce:

Config:

The error is not in my config. You can try it with any config.

Screenshots:

None.

Log:

(click to expand) ``` 2020-01-25T13:26:00.433769187Z 2020-01-25 14:26:00 ERROR flask.app Exception on /server/raw_config [POST] 2020-01-25T13:26:00.433815441Z Traceback (most recent call last): 2020-01-25T13:26:00.433829799Z File "/usr/lib/python3.8/threading.py", line 890, in _bootstrap 2020-01-25T13:26:00.433842726Z self._bootstrap_inner() 2020-01-25T13:26:00.433854766Z | -> 2020-01-25T13:26:00.433867451Z -> 2020-01-25T13:26:00.433879745Z File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner 2020-01-25T13:26:00.433892524Z self.run() 2020-01-25T13:26:00.433903938Z | -> 2020-01-25T13:26:00.433915905Z -> 2020-01-25T13:26:00.433927950Z File "/usr/lib/python3.8/site-packages/cheroot/workers/threadpool.py", line 125, in run 2020-01-25T13:26:00.433939964Z keep_conn_open = conn.communicate() 2020-01-25T13:26:00.433951848Z | -> 2020-01-25T13:26:00.433964137Z -> 2020-01-25T13:26:00.433976215Z File "/usr/lib/python3.8/site-packages/cheroot/server.py", line 1280, in communicate 2020-01-25T13:26:00.433988151Z req.respond() 2020-01-25T13:26:00.433999641Z | -> 2020-01-25T13:26:00.434011559Z -> 2020-01-25T13:26:00.434023556Z File "/usr/lib/python3.8/site-packages/cheroot/server.py", line 1083, in respond 2020-01-25T13:26:00.434035907Z self.server.gateway(self).respond() 2020-01-25T13:26:00.434047694Z | | | -> 2020-01-25T13:26:00.434071261Z | | -> 2020-01-25T13:26:00.434083029Z | -> 2020-01-25T13:26:00.434094885Z -> 2020-01-25T13:26:00.434106500Z File "/usr/lib/python3.8/site-packages/cheroot/wsgi.py", line 143, in respond 2020-01-25T13:26:00.434118377Z response = self.req.server.wsgi_app(self.env, self.start_response) 2020-01-25T13:26:00.434129877Z | | | | | | | -> 2020-01-25T13:26:00.434141703Z | | | | | | -> 2020-01-25T13:26:00.434155923Z | | | | | -> {'ACTUAL_SERVER_PROTOCOL': 'HTTP/1.1', 'PATH_INFO': '/api/server/raw_config', 'QUERY_STRING': '', 'REMOTE_ADDR': '172.20.0.7'... 2020-01-25T13:26:00.434168595Z | | | | -> 2020-01-25T13:26:00.434180300Z | | | -> 2020-01-25T13:26:00.434192204Z | | -> 2020-01-25T13:26:00.434203923Z | -> 2020-01-25T13:26:00.434215528Z -> 2020-01-25T13:26:00.434227221Z File "/usr/lib/python3.8/site-packages/cherrypy/_cptree.py", line 302, in __call__ 2020-01-25T13:26:00.434238761Z return app(environ, start_response) 2020-01-25T13:26:00.434250175Z | | -> > 2020-01-25T13:26:00.434262305Z | -> {'ACTUAL_SERVER_PROTOCOL': 'HTTP/1.1', 'PATH_INFO': '/server/raw_config', 'QUERY_STRING': '', 'REMOTE_ADDR': '172.20.0.7', 'R... 2020-01-25T13:26:00.434274259Z -> 2020-01-25T13:26:00.434285867Z File "/usr/lib/python3.8/site-packages/flask/app.py", line 2309, in __call__ 2020-01-25T13:26:00.434297312Z return self.wsgi_app(environ, start_response) 2020-01-25T13:26:00.434308713Z | | | -> > 2020-01-25T13:26:00.434320839Z | | -> {'ACTUAL_SERVER_PROTOCOL': 'HTTP/1.1', 'PATH_INFO': '/server/raw_config', 'QUERY_STRING': '', 'REMOTE_ADDR': '172.20.0.7', 'R... 2020-01-25T13:26:00.434332780Z | -> 2020-01-25T13:26:00.434344378Z -> 2020-01-25T13:26:00.434356070Z File "/usr/lib/python3.8/site-packages/flask/app.py", line 2292, in wsgi_app 2020-01-25T13:26:00.434373760Z response = self.full_dispatch_request() 2020-01-25T13:26:00.434385367Z | -> 2020-01-25T13:26:00.434397017Z -> 2020-01-25T13:26:00.434408608Z > File "/usr/lib/python3.8/site-packages/flask/app.py", line 1813, in full_dispatch_request 2020-01-25T13:26:00.434420401Z rv = self.dispatch_request() 2020-01-25T13:26:00.434431845Z | -> 2020-01-25T13:26:00.434443366Z -> 2020-01-25T13:26:00.434454796Z File "/usr/lib/python3.8/site-packages/flask/app.py", line 1799, in dispatch_request 2020-01-25T13:26:00.434466221Z return self.view_functions[rule.endpoint](**req.view_args) 2020-01-25T13:26:00.434478283Z | | | | | -> {} 2020-01-25T13:26:00.434490117Z | | | | -> 2020-01-25T13:26:00.434502193Z | | | -> 'server_server_raw_config_api' 2020-01-25T13:26:00.434513699Z | | -> server_server_raw_config_api> 2020-01-25T13:26:00.434525589Z | -> {'static': >, 'specs': 2020-01-25T13:26:00.434550254Z File "/usr/lib/python3.8/site-packages/flask_restplus/api.py", line 313, in wrapper 2020-01-25T13:26:00.434561795Z resp = resource(*args, **kwargs) 2020-01-25T13:26:00.434573209Z | | -> {} 2020-01-25T13:26:00.434585000Z | -> () 2020-01-25T13:26:00.434596626Z -> .view at 0x7fbf711ead30> 2020-01-25T13:26:00.434608429Z File "/usr/lib/python3.8/site-packages/flask/views.py", line 88, in view 2020-01-25T13:26:00.434619950Z return self.dispatch_request(*args, **kwargs) 2020-01-25T13:26:00.434640259Z | | | -> {} 2020-01-25T13:26:00.434651731Z | | -> () 2020-01-25T13:26:00.434663978Z | -> 2020-01-25T13:26:00.434675565Z -> 2020-01-25T13:26:00.434687056Z File "/usr/lib/python3.8/site-packages/flask_restplus/resource.py", line 44, in dispatch_request 2020-01-25T13:26:00.434704908Z resp = meth(*args, **kwargs) 2020-01-25T13:26:00.434716284Z | | -> {} 2020-01-25T13:26:00.434727747Z | -> () 2020-01-25T13:26:00.434739148Z -> .decorator..wrapper at 0x7fbf6e6caa60> 2020-01-25T13:26:00.434751024Z File "/usr/lib/python3.8/site-packages/flexget/api/app.py", line 74, in wrapped 2020-01-25T13:26:00.434762536Z rv = f(*args, **kwargs) 2020-01-25T13:26:00.434773606Z | | -> {} 2020-01-25T13:26:00.434784800Z | -> () 2020-01-25T13:26:00.434796261Z -> .decorator..wrapper at 0x7fbf6e6ca9d0> 2020-01-25T13:26:00.434808338Z File "/usr/lib/python3.8/site-packages/flexget/utils/database.py", line 29, in wrapper 2020-01-25T13:26:00.434820140Z return func(*args, **kwargs) 2020-01-25T13:26:00.434831688Z | | -> {'session': } 2020-01-25T13:26:00.434843615Z | -> () 2020-01-25T13:26:00.434856136Z -> > 2020-01-25T13:26:00.434868525Z File "/usr/lib/python3.8/site-packages/flexget/api/app.py", line 118, in wrapper 2020-01-25T13:26:00.434880357Z return func(*args, **kwargs) 2020-01-25T13:26:00.434891758Z | | -> {'session': } 2020-01-25T13:26:00.434903841Z | -> (,) 2020-01-25T13:26:00.434915784Z -> 2020-01-25T13:26:00.434927536Z File "/usr/lib/python3.8/site-packages/flexget/api/core/server.py", line 229, in post 2020-01-25T13:26:00.434939473Z backup_path = self.manager.update_config(config) 2020-01-25T13:26:00.434950836Z | | -> 2020-01-25T13:26:00.434962674Z | -> 2020-01-25T13:26:00.434974461Z -> 2020-01-25T13:26:00.434986241Z 2020-01-25T13:26:00.434997513Z UnboundLocalError: local variable 'config' referenced before assignment ```

Additional information:

kristenmills commented 4 years ago

Thansks for reporting. Yeah i can reproduce this. Seems this might be because of a known issue with base64 encoding unicode string (https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_Unicode_Problem). Seems like there are some workarounds provided, will look into it.

kristenmills commented 4 years ago

@junpet the fix should be in the next flexget release tomorrow.