dev文件夹合并至utils

This commit is contained in:
wojiaoyishang
2023-02-11 13:34:46 +08:00
parent 0ad00448d8
commit 67b1462453
15 changed files with 107 additions and 108 deletions
+9 -1
View File
@@ -2,7 +2,15 @@
from flask import abort, make_response, jsonify, escape
def str_escape(s):
def str_escape(s: str) -> str:
"""xss过滤,内部采用flask自带的过滤函数。
与原过滤函数不同的是此过滤函数将在 s 为 None 时返回 None。
:param s: 要过滤的字符串
:type s: str
:return: s 为 None 时返回 None,否则过滤字符串后返回。
:rtype: str
"""
if not s:
return None
return str(escape(s))