raelgc / scudcloud

ScudCloud - Slack for Linux
https://launchpad.net/~rael-gc/+archive/ubuntu/scudcloud
MIT License
1.22k stars 99 forks source link

scudcloud crashes if no http proxy has been configured #580

Closed bodewig closed 7 years ago

bodewig commented 7 years ago

ScudCloud Version

Paste the output for scudcloud --version below:

ScudCloud 1.59 Python 3.5.2 Qt 5.5.1 PyQt 5.5.1 SIP 4.17

Distro and Desktop info

Expected behavior

scudcloud starts

Actual behavior

it crashes with

$ scudcloud 
Traceback (most recent call last):
  File "/usr/bin/scudcloud", line 9, in <module>
    load_entry_point('scudcloud==1.59', 'gui_scripts', 'scudcloud')()
  File "/usr/lib/python3/dist-packages/scudcloud/__main__.py", line 67, in main
    cache_path=cache_path
  File "/usr/lib/python3/dist-packages/scudcloud/scudcloud.py", line 80, in __init__
    self.addWrapper(self.startURL)
  File "/usr/lib/python3/dist-packages/scudcloud/scudcloud.py", line 120, in addWrapper
    webView = Wrapper(self)
  File "/usr/lib/python3/dist-packages/scudcloud/wrapper.py", line 24, in __init__
    self.configure_proxy()
  File "/usr/lib/python3/dist-packages/scudcloud/wrapper.py", line 50, in configure_proxy
    url_decode = unquote(url)
  File "/usr/lib/python3.5/urllib/parse.py", line 537, in unquote
    if '%' not in string:
TypeError: argument of type 'NoneType' is not iterable

Steps to reproduce

  1. start scudcloud with neither http_proxy nor HTTP_PROXY environment variables set

Workaround

start with an empty HTTP_PROXY environment

> HTTP_PROXY= scudcloud
bh commented 7 years ago

Same here for Archlinux x86_64, Python 3.6.1

$ /usr/bin/scudcloud   
Traceback (most recent call last):
  File "/usr/bin/scudcloud", line 11, in <module>
    load_entry_point('scudcloud==1.59', 'gui_scripts', 'scudcloud')()
  File "/usr/lib/python3.6/site-packages/scudcloud/__main__.py", line 67, in main
    cache_path=cache_path
  File "/usr/lib/python3.6/site-packages/scudcloud/scudcloud.py", line 80, in __init__
    self.addWrapper(self.startURL)
  File "/usr/lib/python3.6/site-packages/scudcloud/scudcloud.py", line 120, in addWrapper
    webView = Wrapper(self)
  File "/usr/lib/python3.6/site-packages/scudcloud/wrapper.py", line 24, in __init__
    self.configure_proxy()
  File "/usr/lib/python3.6/site-packages/scudcloud/wrapper.py", line 50, in configure_proxy
    url_decode = unquote(url)
  File "/usr/lib/python3.6/urllib/parse.py", line 600, in unquote
    if '%' not in string:
TypeError: argument of type 'NoneType' is not iterable
$ HTTP_PROXY= /usr/bin/scudcloud

works fine :-)

Thanks for the patch!

barjo commented 7 years ago

Look likes there is no default value for the proxy url: https://github.com/raelgc/scudcloud/blob/master/scudcloud/wrapper.py#L49

-        url = os.environ.get('http_proxy') or os.environ.get('HTTP_PROXY')
+        url = os.environ.get('http_proxy') or os.environ.get('HTTP_PROXY', '')