From cff1cd3b8f76f009a099708f0f7f86161510ab2d Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Tue, 15 Sep 2009 14:23:38 +0200 Subject: [PATCH] Fix bug that results in "None" filename --- src/gpodder/download.py | 2 ++ src/gpodder/model.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gpodder/download.py b/src/gpodder/download.py index b32e5a83..acd32f0c 100644 --- a/src/gpodder/download.py +++ b/src/gpodder/download.py @@ -64,6 +64,8 @@ def get_header_param(headers, param, header_name): msg = email.message_from_string('\n'.join(headers_string)) if header_name in msg: value = msg.get_param(param, header=header_name) + if value is None: + return None decoded_list = email.Header.decode_header(value) value = [] for part, encoding in decoded_list: diff --git a/src/gpodder/model.py b/src/gpodder/model.py index 03400076..7487b954 100644 --- a/src/gpodder/model.py +++ b/src/gpodder/model.py @@ -783,7 +783,7 @@ class PodcastEpisode(PodcastModelObject): next_try_id = 2 lookup_url = None - if self.filename == current_try: + if self.filename == current_try and current_try is not None: # We already have this filename - good! return current_try @@ -912,8 +912,11 @@ class PodcastEpisode(PodcastModelObject): else: log('Warning: %s exists or %s does not.', new_file_name, old_file_name, sender=self) log('Updating filename of %s to "%s".', self.url, wanted_filename, sender=self) + elif self.filename is None: + log('Setting filename to "%s".', wanted_filename, sender=self) else: - log('Should update filename. Stays the same. Good!', sender=self) + log('Should update filename. Stays the same (%s). Good!', \ + wanted_filename, sender=self) self.filename = wanted_filename self.save() self.db.commit() -- 2.11.4.GIT