mirror of
https://github.com/MeoProject/lx-music-api-server.git
synced 2025-05-23 19:17:41 +08:00
fix: 修复Python3.10以下无法启动
This commit is contained in:
parent
10dcfdb8aa
commit
bdf03dbfdd
@ -18,6 +18,7 @@ import re
|
|||||||
import xmltodict
|
import xmltodict
|
||||||
import ipaddress
|
import ipaddress
|
||||||
from urllib.parse import quote, unquote, urlparse
|
from urllib.parse import quote, unquote, urlparse
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
def createBase64Encode(data_bytes):
|
def createBase64Encode(data_bytes):
|
||||||
encoded_data = base64.b64encode(data_bytes)
|
encoded_data = base64.b64encode(data_bytes)
|
||||||
@ -65,7 +66,7 @@ def filterFileName(filename):
|
|||||||
# 将不合法字符替换为下划线
|
# 将不合法字符替换为下划线
|
||||||
return re.sub(illegal_chars, '_', filename)
|
return re.sub(illegal_chars, '_', filename)
|
||||||
|
|
||||||
def createMD5(s: (str | bytes)):
|
def createMD5(s: Union[str, bytes]):
|
||||||
if (isinstance(s, str)):
|
if (isinstance(s, str)):
|
||||||
s = s.encode("utf-8")
|
s = s.encode("utf-8")
|
||||||
return hashlib.md5(s).hexdigest()
|
return hashlib.md5(s).hexdigest()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user