From 6344be480e476ab45c71698d4ec00f435e3f25bc Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 9 Aug 2010 19:55:24 +0200 Subject: [PATCH] check that url actually served an image --- oxdata/poster/models.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/oxdata/poster/models.py b/oxdata/poster/models.py index b3ab891..911e6d7 100644 --- a/oxdata/poster/models.py +++ b/oxdata/poster/models.py @@ -79,6 +79,13 @@ class PosterCache(models.Model): self.status = e.reason self.failed = True self.save() + if self.image: + try: + self.image.width + except TypeError: + self.failed = True + self.status = "invalid image" + self.image.delete() return self.image class Poster(models.Model):