mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-14 22:33:17 +00:00
Merge pull request #4961 from haiwen/cache-key-length
use sha1 encrypted str as cache key
This commit is contained in:
@@ -13,7 +13,7 @@ from seaserv import seafile_api
|
||||
|
||||
from seahub.base.templatetags.seahub_tags import email2nickname
|
||||
from seahub.utils import get_file_type_and_ext, gen_file_get_url, \
|
||||
get_site_scheme_and_netloc, normalize_cache_key
|
||||
get_site_scheme_and_netloc, encrypt_with_sha1
|
||||
from seahub.utils.file_op import if_locked_by_online_office
|
||||
|
||||
from seahub.settings import ENABLE_WATERMARK
|
||||
@@ -25,9 +25,8 @@ logger = logging.getLogger('onlyoffice')
|
||||
|
||||
|
||||
def generate_onlyoffice_cache_key(repo_id, file_path):
|
||||
prefix = "ONLYOFFICE_"
|
||||
value = "%s_%s" % (repo_id, file_path)
|
||||
return normalize_cache_key(value, prefix)
|
||||
|
||||
return "ONLYOFFICE_{}_{}".format(repo_id, encrypt_with_sha1(file_path))
|
||||
|
||||
|
||||
def get_onlyoffice_dict(request, username, repo_id, file_path, file_id='',
|
||||
|
@@ -1387,3 +1387,8 @@ def is_valid_org_id(org_id):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def encrypt_with_sha1(origin_str):
|
||||
|
||||
return hashlib.sha1(origin_str.encode()).hexdigest()
|
||||
|
Reference in New Issue
Block a user