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
1 changed files with 7 additions and 0 deletions

View File

@ -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):