update applications/common/utils/validate.py.
Signed-off-by: 我叫以赏 <422880152@qq.com>
This commit is contained in:
@@ -3,14 +3,6 @@ from flask import abort, make_response, jsonify, escape
|
|||||||
|
|
||||||
|
|
||||||
def str_escape(s: str) -> str:
|
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:
|
if not s:
|
||||||
return None
|
return None
|
||||||
return str(escape(s))
|
return str(escape(s))
|
||||||
|
|||||||
Reference in New Issue
Block a user