use extension from url

This commit is contained in:
j 2012-07-05 15:51:57 +02:00
parent e3ffa98d92
commit ece58dad63
1 changed files with 1 additions and 1 deletions

View File

@ -76,7 +76,7 @@ class PosterCache(models.Model):
name = hashlib.sha1(url).hexdigest()
try:
data = ox.net.readUrl(url)
self.image.name = poster_path(self.url, 'image.jpg')
self.image.name = poster_path(self.url, os.path.basename(url))
ox.makedirs(os.path.dirname(self.image.path))
with open(self.image.path, 'w') as f:
f.write(data)