work around broken db
This commit is contained in:
parent
7d0d473acd
commit
3d882425e4
1 changed files with 7 additions and 1 deletions
|
@ -191,7 +191,13 @@ class UploadHandler(tornado.web.RequestHandler):
|
|||
file.move()
|
||||
else:
|
||||
user = state.user()
|
||||
item = file.item
|
||||
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)
|
||||
item.add_user(user)
|
||||
|
|
Loading…
Reference in a new issue