Prepend image

main
Bob Mottram 2021-07-09 21:26:33 +01:00
parent 266eb1af47
commit d1b1e18af4
1 changed files with 3 additions and 3 deletions

View File

@ -10128,7 +10128,7 @@ class PubServer(BaseHTTPRequestHandler):
# The file has not changed # The file has not changed
self._304() self._304()
return True return True
mediaImageType = 'png' mediaImageType = 'image/png'
extensionsToMime = { extensionsToMime = {
'jpg': 'jpeg', 'jpg': 'jpeg',
'gif': 'gif', 'gif': 'gif',
@ -10138,12 +10138,12 @@ class PubServer(BaseHTTPRequestHandler):
} }
for ext, mimeExt in extensionsToMime.items(): for ext, mimeExt in extensionsToMime.items():
if avatarFile.endswith('.' + ext): if avatarFile.endswith('.' + ext):
mediaImageType = mimeExt mediaImageType = 'image/' + mimeExt
break break
with open(avatarFilename, 'rb') as avFile: with open(avatarFilename, 'rb') as avFile:
mediaBinary = avFile.read() mediaBinary = avFile.read()
self._set_headers_etag(avatarFilename, self._set_headers_etag(avatarFilename,
'image/' + mediaImageType, mediaImageType,
mediaBinary, None, mediaBinary, None,
self.server.domainFull) self.server.domainFull)
self._write(mediaBinary) self._write(mediaBinary)