Skip to content

Commit

Permalink
Merge branch '2.7-hotfix' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Sep 27, 2018
2 parents d32e563 + 00d2fe8 commit 7f9afca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/roam/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import re
import zipfile
import urlparse
import urllib
import urllib2
import Queue
import logging
Expand All @@ -27,6 +28,10 @@ class UpdateExpection(Exception):
pass


def quote_url(url):
return urllib.quote(url, safe="%/:=&?~#+!$,;'@()*[]")


def add_slash(url):
if not url.endswith("/"):
url += "/"
Expand Down Expand Up @@ -106,6 +111,8 @@ def download_file(url, fileout):
Will open and write to fileout
"""
url = quote_url(url)

roam.utils.debug("Opening URL: {}".format(url))
try:
result = urllib2.urlopen(url)
Expand Down Expand Up @@ -198,6 +205,7 @@ def __init__(self, basefolder):
self.projectUpdateStatus.connect(self.status_updated)

def check_url_found(self, url):
url = quote_url(url)
try:
result = urllib2.urlopen(url)
return result.code == 200
Expand Down

0 comments on commit 7f9afca

Please sign in to comment.