work around broken db
This commit is contained in:
parent
7d0d473acd
commit
3d882425e4
1 changed files with 7 additions and 1 deletions
|
@ -191,6 +191,12 @@ class UploadHandler(tornado.web.RequestHandler):
|
|||
file.move()
|
||||
else:
|
||||
user = state.user()
|
||||
if not file.item:
|
||||
item = Item.get_or_create(id=file.sha1, info=file.info)
|
||||
file.item_id = item.id
|
||||
state.db.session.add(file)
|
||||
state.db.session.commit()
|
||||
else:
|
||||
item = file.item
|
||||
if user not in item.users:
|
||||
logger.debug('add %s to local user', id)
|
||||
|
|
Loading…
Reference in a new issue