File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 1010#
1111import asyncio
1212import email
13+ import hashlib
1314import itertools
1415import os
1516import pathlib
@@ -1678,6 +1679,9 @@ class Cache:
16781679 def __attrs_post_init__ (self ):
16791680 os .makedirs (self .directory , exist_ok = True )
16801681
1682+ def sha256_hash (self , text : str ) -> str :
1683+ return hashlib .sha256 (text .encode ()).hexdigest ()
1684+
16811685 async def get (
16821686 self ,
16831687 credentials ,
@@ -1693,7 +1697,7 @@ async def get(
16931697 True otherwise as treat as binary. `path_or_url` can be a path or a URL
16941698 to a file.
16951699 """
1696- cache_key = quote_plus (path_or_url .strip ("/" ))
1700+ cache_key = self . sha256_hash ( quote_plus (path_or_url .strip ("/" ) ))
16971701 cached = os .path .join (self .directory , cache_key )
16981702
16991703 if force or not os .path .exists (cached ):
You can’t perform that action at this time.
0 commit comments