[kupfer] plugin.urlactions: Fix naming of downloaded urls
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] plugin.urlactions: Fix naming of downloaded urls
- Date: Tue, 15 Sep 2009 17:54:04 +0000 (UTC)
commit 13b2a5fe5ea857ca48f8c0c42ae864826c6199f9
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Tue Sep 15 02:12:33 2009 +0200
plugin.urlactions: Fix naming of downloaded urls
Basename would return a "" name on URLs ending with a slash.
kupfer/plugin/urlactions.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/plugin/urlactions.py b/kupfer/plugin/urlactions.py
index 48e3ed7..58564d3 100644
--- a/kupfer/plugin/urlactions.py
+++ b/kupfer/plugin/urlactions.py
@@ -20,8 +20,10 @@ class DownloadTask (task.StepTask):
super(DownloadTask, self).__init__()
self.response = urllib2.urlopen(uri)
+ def make_url_name(url):
+ return os.path.basename(url.rstrip("/"))
header_basename = self.response.headers.get('Content-Disposition')
- destname = header_basename or os.path.basename(self.response.url)
+ destname = header_basename or make_url_name(self.response.url)
if tempfile:
(self.destfile, self.destpath) = utils.get_safe_tempfile()
else:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]