diff options
Diffstat (limited to 'module/plugins/internal/Base.py')
-rw-r--r-- | module/plugins/internal/Base.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py index 28b648994..052fc228f 100644 --- a/module/plugins/internal/Base.py +++ b/module/plugins/internal/Base.py @@ -463,10 +463,11 @@ class Base(Plugin): value = value.strip() if key in header: - if type(header[key]) is list: - header[key].append(value) + header_key = header.get(key) + if type(header_key) is list: + header_key.append(value) else: - header[key] = [header[key], value] + header[key] = [header_key, value] else: header[key] = value @@ -474,7 +475,7 @@ class Base(Plugin): link = url elif header.get('location'): - location = self.fixurl(header['location'], url) + location = self.fixurl(header.get('location'), url) if header.get('code') == 302: link = location @@ -487,7 +488,7 @@ class Base(Plugin): extension = os.path.splitext(parse_name(url))[-1] if header.get('content-type'): - mimetype = header['content-type'].split(';')[0].strip() + mimetype = header.get('content-type').split(';')[0].strip() elif extension: mimetype = mimetypes.guess_type(extension, False)[0] or "application/octet-stream" |