check that url actually served an image

This commit is contained in:
j 2010-08-09 19:55:24 +02:00
parent 6e9110eb42
commit 6344be480e

View file

@ -79,6 +79,13 @@ class PosterCache(models.Model):
self.status = e.reason self.status = e.reason
self.failed = True self.failed = True
self.save() self.save()
if self.image:
try:
self.image.width
except TypeError:
self.failed = True
self.status = "invalid image"
self.image.delete()
return self.image return self.image
class Poster(models.Model): class Poster(models.Model):