virt-manager/eae7dc06-fix-URL-installs-when-content-length-header-missing.patch
Charles Arnold 9851188d58 - bsc#962221 - virt-install: 'NoneType' object has no attribute
'isdigit' 
  eae7dc06-fix-URL-installs-when-content-length-header-missing.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=291
2016-01-18 20:48:51 +00:00

26 lines
954 B
Diff

Subject: urlfetcher: Fix URL installs when content-length header missing
From: Cole Robinson crobinso@redhat.com Tue Jan 12 12:45:02 2016 -0500
Date: Tue Jan 12 12:45:02 2016 -0500:
Git: eae7dc061968a83fef8ebb632c8f939621ff22b1
Suggested-by: bduff@sjm.com
Index: virt-manager-1.3.2/virtinst/urlfetcher.py
===================================================================
--- virt-manager-1.3.2.orig/virtinst/urlfetcher.py
+++ virt-manager-1.3.2/virtinst/urlfetcher.py
@@ -186,8 +186,11 @@ class _HTTPURLFetcher(_URLFetcher):
"""
response = requests.get(url, stream=True)
response.raise_for_status()
- size = response.headers.get('content-length')
- return response, size.isdigit() and int(size) or None
+ try:
+ size = int(response.headers.get('content-length'))
+ except:
+ size = None
+ return response, size
def _write(self, urlobj, fileobj):
"""