make sure dropped file is owned by user

This commit is contained in:
j 2016-01-10 11:43:03 +05:30
commit fbf06a1545
2 changed files with 14 additions and 4 deletions

View file

@ -22,6 +22,7 @@ import tornado.concurrent
from oxtornado import json_dumps, json_response
from media import get_id
import state
import logging
logger = logging.getLogger(__name__)
@ -183,6 +184,9 @@ class UploadHandler(tornado.web.RequestHandler):
with open(import_name, 'wb') as fd:
fd.write(upload.body)
file = add_file(id, import_name, prefix_books)
else:
user = state.user()
file.item.add_user(user)
if listname and ids:
l = List.get(settings.USER_ID, listname)
if l: