Skip to content

Commit a1491be

Browse files
committed
Merge branch 'add-http' of https://github.com/djw8605/StashCache-1 into add-pypi
2 parents 174bc17 + 1b02bc1 commit a1491be

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

stashcp.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,13 @@ def download_with_http(source, destination, debug):
340340

341341
# Append port 8000, which is just a convention for now, not set in stone
342342
cache += ":8000"
343-
curl_command = "cd %s; curl %s -L --connect-timeout 30 --speed-limit 1024 %s --fail %s%s" % (dest_dir, output_mode, download_output, cache, source)
343+
344+
# Quote the source URL, which may have weird, dangerous characters
345+
quoted_source = urllib2.quote(source)
346+
curl_command = "curl %s -L --connect-timeout 30 --speed-limit 1024 %s --fail %s%s" % (output_mode, download_output, cache, quoted_source)
344347
logging.debug("About to run curl command: %s", curl_command)
345348
start = int(time.time()*1000)
346-
command_object = subprocess.Popen([curl_command], shell=True)
349+
command_object = subprocess.Popen([curl_command], shell=True, cwd=dest_dir)
347350
command_object.wait()
348351
end = int(time.time()*1000)
349352

0 commit comments

Comments
 (0)