mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 02:53:38 +02:00
Dont use pickle for calculating book hashes for the server
This has the unfortunate side-effect of making existing caches stale, but cant be helped, given the instability of pickle as a serialization format.
This commit is contained in:
parent
74497a4ff8
commit
c98cc3383d
1 changed files with 2 additions and 2 deletions
|
|
@ -7,7 +7,6 @@
|
|||
from hashlib import sha1
|
||||
from functools import partial
|
||||
from threading import RLock, Lock
|
||||
from cPickle import dumps
|
||||
import errno, os, tempfile, shutil, time, json as jsonlib
|
||||
|
||||
from calibre.constants import cache_dir, iswindows
|
||||
|
|
@ -17,6 +16,7 @@
|
|||
from calibre.srv.errors import HTTPNotFound, BookNotFound
|
||||
from calibre.srv.routes import endpoint, json
|
||||
from calibre.srv.utils import get_library_data, get_db
|
||||
from calibre.utils.serialize import json_dumps
|
||||
|
||||
cache_lock = RLock()
|
||||
queued_jobs = {}
|
||||
|
|
@ -49,7 +49,7 @@ def books_cache_dir():
|
|||
|
||||
|
||||
def book_hash(library_uuid, book_id, fmt, size, mtime):
|
||||
raw = dumps((library_uuid, book_id, fmt.upper(), size, mtime, RENDER_VERSION))
|
||||
raw = json_dumps((library_uuid, book_id, fmt.upper(), size, mtime, RENDER_VERSION))
|
||||
return sha1(raw).hexdigest().decode('ascii')
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue