httpserver: Fix favicon handling.

This commit is contained in:
Valentin Lorentz 2014-04-02 17:18:20 +00:00
parent 33262e125f
commit 048c1e77f4

View File

@ -361,15 +361,15 @@ class Favicon(SupyHTTPServerCallback):
file_path = conf.supybot.servers.http.favicon() file_path = conf.supybot.servers.http.favicon()
found = False found = False
if file_path: if file_path:
response = None
try: try:
icon = open(file_path, 'r') icon = open(file_path, 'r')
found = True response = icon.read()
except IOError: except IOError:
pass pass
finally: finally:
icon.close() icon.close()
if found: if response is not None:
response = icon.read()
filename = file_path.rsplit(os.sep, 1)[1] filename = file_path.rsplit(os.sep, 1)[1]
if '.' in filename: if '.' in filename:
ext = filename.rsplit('.', 1)[1] ext = filename.rsplit('.', 1)[1]