OpenInternet / copilot

An easy to use censorship simulating access point in a box
https://openinternet.github.io/copilot/
GNU Lesser General Public License v3.0
26 stars 2 forks source link

Clicking on the "Load" button when no profiles have been saved yet causes an error #64

Closed seamustuohy closed 9 years ago

seamustuohy commented 9 years ago

Stack trace points to the profiles view line 101 with the error OSError: [Errorno 2] No such file or directory: '/tmp/copilot/profiles/'

This is obviously a lack of checking for if that directory exists.

seamustuohy commented 9 years ago

To fix I will add some good old duck typing to catch this and then something in the renderer that is "sad" that there are no profiles yet but suggests creating a new profile. (see issue https://github.com/OpenInternet/co-pilot/issues/65)

The code will look something like the below.

try:
    profiles = [BLAH BLAH BLAH]
except OSError:
    profiles  = [""]
    no_profiles = True
seamustuohy commented 9 years ago

Addressed in https://github.com/OpenInternet/co-pilot/commit/b03a6f55dbb9f86cf5d31e1508ee06e3c6335835