temporary hack to ignore svg files

This commit is contained in:
Jean-Marie Favreau 2025-03-16 06:06:47 +01:00
parent 8b8c30d1b7
commit 957c99e57d

View File

@ -1328,15 +1328,16 @@ class Event(models.Model):
pass
ext = basename.split(".")[-1]
filename = "%s.%s" % (uuid.uuid4(), ext)
if ext[:3].lower() != "svg": # temporary hack to ignore svg files
filename = "%s.%s" % (uuid.uuid4(), ext)
try:
tmpfile, _ = urllib.request.urlretrieve(self.image)
except Exception:
return None
try:
tmpfile, _ = urllib.request.urlretrieve(self.image)
except Exception:
return None
# if the download is ok, then create the corresponding file object
self.local_image = File(name=filename, file=open(tmpfile, "rb"))
# if the download is ok, then create the corresponding file object
self.local_image = File(name=filename, file=open(tmpfile, "rb"))
def add_pending_organisers(self, organisers):
self.pending_organisers = organisers