From 30bee5c7a7b6d1236bcdc9590e9ac6ed8053c2f5 Mon Sep 17 00:00:00 2001 From: Sworddragon Date: Sat, 21 Apr 2012 16:45:47 +0200 Subject: [PATCH] Fixed getting the correct filename --- scripts/build.py | 7 ++----- scripts/make_release.py | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/scripts/build.py b/scripts/build.py index ca23ae8b8..464d9691f 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -82,11 +82,8 @@ work_dir = root_dir + "scripts/work" def fetch_file(url): try: print("trying %s" % url) - real_url = url_lib.urlopen(url).geturl() - local = real_url.split("/") - local = local[len(local)-1].split("?") - local = local[0] - url_lib.urlretrieve(real_url, local) + local = dict(url_lib.urlopen(url).info())['content-disposition'].split('=')[1] + url_lib.urlretrieve(url, local) return local except: return False diff --git a/scripts/make_release.py b/scripts/make_release.py index 3f6bfd5ec..a4fba1fa3 100644 --- a/scripts/make_release.py +++ b/scripts/make_release.py @@ -50,11 +50,8 @@ if platform == 'osx': def fetch_file(url): try: print("trying %s" % url) - real_url = url_lib.urlopen(url).geturl() - local = real_url.split("/") - local = local[len(local)-1].split("?") - local = local[0] - url_lib.urlretrieve(real_url, local) + local = dict(url_lib.urlopen(url).info())['content-disposition'].split('=')[1] + url_lib.urlretrieve(url, local) return local except: return False