Fix version checking if response is empty

This commit is contained in:
Simon Hanna 2017-12-29 11:27:58 +01:00
parent 6e2bc427a7
commit 0f23d12d72

View File

@ -76,12 +76,12 @@ class VersionWorker(QtCore.QObject):
""" """
log.debug('VersionWorker - Start') log.debug('VersionWorker - Start')
# I'm not entirely sure why this was here, I'm commenting it out until I hit the same scenario # I'm not entirely sure why this was here, I'm commenting it out until I hit the same scenario
time.sleep(1) # time.sleep(1)
download_url = 'http://www.openlp.org/files/version.txt' download_url = 'https://www.openlp.org/files/version.txt'
if self.current_version['build']: if self.current_version['build']:
download_url = 'http://www.openlp.org/files/nightly_version.txt' download_url = 'https://www.openlp.org/files/nightly_version.txt'
elif int(self.current_version['version'].split('.')[1]) % 2 != 0: elif int(self.current_version['version'].split('.')[1]) % 2 != 0:
download_url = 'http://www.openlp.org/files/dev_version.txt' download_url = 'https://www.openlp.org/files/dev_version.txt'
headers = { headers = {
'User-Agent': 'OpenLP/{version} {system}/{release}; '.format(version=self.current_version['full'], 'User-Agent': 'OpenLP/{version} {system}/{release}; '.format(version=self.current_version['full'],
system=platform.system(), system=platform.system(),
@ -92,7 +92,7 @@ class VersionWorker(QtCore.QObject):
while retries < 3: while retries < 3:
try: try:
response = requests.get(download_url, headers=headers) response = requests.get(download_url, headers=headers)
remote_version = response.text remote_version = response.text.strip()
log.debug('New version found: %s', remote_version) log.debug('New version found: %s', remote_version)
break break
except OSError: except OSError: