mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
fix: Cleanup serialization and hashing code (#14317)
This commit is contained in:
@@ -19,7 +19,6 @@ import collections
|
||||
import decimal
|
||||
import errno
|
||||
import functools
|
||||
import hashlib
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
@@ -99,6 +98,7 @@ from superset.exceptions import (
|
||||
)
|
||||
from superset.typing import FlaskResponse, FormData, Metric
|
||||
from superset.utils.dates import datetime_to_epoch, EPOCH
|
||||
from superset.utils.hashing import md5_sha_from_str
|
||||
|
||||
try:
|
||||
from pydruid.utils.having import Having
|
||||
@@ -484,10 +484,6 @@ def list_minus(l: List[Any], minus: List[Any]) -> List[Any]:
|
||||
return [o for o in l if o not in minus]
|
||||
|
||||
|
||||
def md5_hex(data: str) -> str:
|
||||
return hashlib.md5(data.encode()).hexdigest()
|
||||
|
||||
|
||||
class DashboardEncoder(json.JSONEncoder):
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
@@ -1381,7 +1377,7 @@ def create_ssl_cert_file(certificate: str) -> str:
|
||||
:return: The path to the certificate file
|
||||
:raises CertificateException: If certificate is not valid/unparseable
|
||||
"""
|
||||
filename = f"{hashlib.md5(certificate.encode('utf-8')).hexdigest()}.crt"
|
||||
filename = f"{md5_sha_from_str(certificate)}.crt"
|
||||
cert_dir = current_app.config["SSL_CERT_PATH"]
|
||||
path = cert_dir if cert_dir else tempfile.gettempdir()
|
||||
path = os.path.join(path, filename)
|
||||
|
||||
Reference in New Issue
Block a user