ensure permissions for uploaded files

This commit is contained in:
j 2011-11-29 18:50:58 +01:00
parent 7bbee07012
commit a1ee861266

View file

@ -146,6 +146,7 @@ def upload(request):
position = float(os.path.splitext(name)[0]) position = float(os.path.splitext(name)[0])
fr, created = models.Frame.objects.get_or_create(file=f, position=position) fr, created = models.Frame.objects.get_or_create(file=f, position=position)
fr.frame.save(name, frame) fr.frame.save(name, frame)
os.chmod(fr.frame.path, 0644)
f.item.select_frame() f.item.select_frame()
f.item.save() f.item.save()
item.tasks.update_poster.delay(f.item.itemId) item.tasks.update_poster.delay(f.item.itemId)
@ -157,6 +158,7 @@ def upload(request):
f.data.delete() f.data.delete()
f.data.save('data.raw', request.FILES['file']) f.data.save('data.raw', request.FILES['file'])
f.save() f.save()
os.chmod(f.data.path, 0644)
item.tasks.load_subtitles.delay(f.item.itemId) item.tasks.load_subtitles.delay(f.item.itemId)
response = json_response(text='file saved') response = json_response(text='file saved')
else: else: