From 7dd73e1330d610c16f5c6ebb113e35c3176682d8 Mon Sep 17 00:00:00 2001 From: yuxiaoyuan0406 <973971990@qq.com> Date: Thu, 20 Apr 2023 18:20:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=A3=80=E6=9F=A5path=E7=9A=84=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- toolbox.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/toolbox.py b/toolbox.py index 5bbe954..4921e6e 100644 --- a/toolbox.py +++ b/toolbox.py @@ -527,3 +527,22 @@ class DummyWith(): def __exit__(self, exc_type, exc_value, traceback): return + +def custom_path_check(path: str)->bool: + ''' + check path for sub url + + path: path to check + + return value: do sub url wrap + ''' + if len(path) == 0: + print("ilegal custom path: {}\npath must not be empty\ndeploy on root url".format(path)) + return False + if path[0] == '/': + if path[1] != '/': + print("deploy on sub-path {}".format(path)) + return True + return False + print("ilegal custom path: {}\npath should begin with \'/\'\ndeploy on root url".format(path)) + return False