[sync] Image save by file not by hash
This commit is contained in:
1 parent
e9fa1376e3
commit
dd0ec5f203
1 file changed
+2
-2
@@ -156,10 +156,10 @@ class Image(Model):
|
|||||||
def sync_image(record):
|
def sync_image(record):
|
||||||
from db import db
|
from db import db
|
||||||
|
|
||||||
q = {'hash': record['hash']}
|
q = {'file': record['file']}
|
||||||
try:
|
try:
|
||||||
db().images.update_one(q, {'$set': record}, upsert=True)
|
db().images.update_one(q, {'$set': record}, upsert=True)
|
||||||
i = db().images.find_one({'hash': record['hash']})
|
i = db().images.find_one({'file': record['file']})
|
||||||
return i
|
return i
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in new issue
Block a user