From e46ace50443c72c728a5c7eda65c0fbb1aeb15da Mon Sep 17 00:00:00 2001 From: BlueGreenMagick <50060875+BlueGreenMagick@users.noreply.github.com> Date: Sat, 29 Feb 2020 12:36:10 +0900 Subject: [PATCH] match both forward slash and os seperator --- qt/aqt/mediasrv.py | 9 ++++----- qt/aqt/webview.py | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/qt/aqt/mediasrv.py b/qt/aqt/mediasrv.py index 84d15d221..4ec231191 100644 --- a/qt/aqt/mediasrv.py +++ b/qt/aqt/mediasrv.py @@ -161,11 +161,10 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler): if not pattern: return path - if not re.fullmatch(pattern, subPath): - return path - - newPath = os.path.join(addMgr.addonsFolder(), addonPath) - return newPath + subPath2 = subPath.replace(os.sep, "/") + if re.fullmatch(pattern, subPath) or re.fullmatch(pattern, subPath2): + newPath = os.path.join(addMgr.addonsFolder(), addonPath) + return newPath return path diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index c31d1da4b..0efc96969 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -149,6 +149,8 @@ class WebContent: f"/_addons/{addon_package}/web/my-addon.css") web_content.js.append( f"/_addons/{addon_package}/web/my-addon.js") + + Note that '/' will also match the os specific path separator. """ body: str = ""