Update core db tests to use the right hash for plugins_page files

This commit is contained in:
Théophile Diot 2023-06-21 13:56:41 -04:00
parent 8231198219
commit 2105dc0f32
No known key found for this signature in database
GPG Key ID: E752C80DB72BB014
2 changed files with 4 additions and 5 deletions

View File

@ -7,7 +7,6 @@ git clone https://github.com/bunkerity/bunkerweb-plugins.git
echo " Checking out to dev branch ..."
cd bunkerweb-plugins
git checkout dev # TODO: remove this when the next release of bw-plugins is out
echo " Extracting ClamAV plugin ..."

View File

@ -1,6 +1,6 @@
from contextlib import contextmanager
from glob import iglob
from hashlib import sha512
from hashlib import sha256
from json import dumps, load
from os import environ, getenv
from os.path import dirname, join
@ -486,14 +486,14 @@ try:
print(" Checking if all plugin pages are in the database ...", flush=True)
def file_hash(file: str) -> str:
_sha512 = sha512()
_sha256 = sha256()
with open(file, "rb") as f:
while True:
data = f.read(1024)
if not data:
break
_sha512.update(data)
return _sha512.hexdigest()
_sha256.update(data)
return _sha256.hexdigest()
with db_session() as session:
plugin_pages = (