Skip to content

Commit

Permalink
fix url decoding issue for encrypted urls
Browse files Browse the repository at this point in the history
  • Loading branch information
erikng committed Nov 30, 2017
1 parent 22c3ec4 commit c5d2b20
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import subprocess
import sys
import time
import urllib
sys.path.append('/usr/local/installapplications')
# PEP8 can really be annoying at times.
import gurl # noqa
Expand Down Expand Up @@ -268,14 +269,16 @@ def download_if_needed(item, stage, type, opts, depnotifystatus):
path = item['file']
name = item['name']
hash = item['hash']
itemurl = item['url']
while not (os.path.isfile(path) and hash == gethash(path)):
# Check if additional headers are being passed and add
# them to the dictionary.
if opts.headers:
item.update({'additional_headers':
{'Authorization': opts.headers}})
# Download the file once:
iaslog('Starting download: %s' % (item['url']))
iaslog('Starting download: %s' % (urllib.unquote(itemurl.decode('utf8')
)))
if opts.depnotify:
if stage == 'setupassistant':
iaslog(
Expand Down Expand Up @@ -435,15 +438,16 @@ def main():
'file': jsonpath,
'name': 'Bootstrap.json'
}

# Grab auth headers if they exist and update the json_data dict.
if opts.headers:
headers = {'Authorization': opts.headers}
json_data.update({'additional_headers': headers})

# If the file doesn't exist, grab it and wait half a second to save.
while not os.path.isfile(jsonpath):
iaslog('Starting download: %s' % (json_data['url']))
iaslog('Starting download: %s' % (urllib.unquote(
json_data['url']).decode('utf8')))
downloadfile(json_data)
time.sleep(0.5)

Expand Down

0 comments on commit c5d2b20

Please sign in to comment.