Add mime type to generated File objects

This commit is contained in:
Kumi 2023-10-27 20:03:33 +02:00
parent 14a0c12457
commit 518a01052c
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -152,7 +152,7 @@ class KRPanoConverter:
assert res.getcode() == 200
content = res.read()
fo = ContentFile(content, name=f"{tile}_{maxzoom}_{y}_{x}.jpg")
file = File.objects.create(conversion=self.conversion, file=fo)
file = File.objects.create(conversion=self.conversion, file=fo, mime_type="image/jpeg")
r_array.append(file)
x += 1
except Exception as e:
@ -187,7 +187,7 @@ class KRPanoConverter:
res = HTTPRequest(cur).open()
assert res.getcode() == 200
fo = ContentFile(res.read())
file = File.objects.create(conversion=self.conversion, file=fo)
file = File.objects.create(conversion=self.conversion, file=fo, mime_type="image/jpeg")
output += [file]
return output