Browse Source

fix url start with dot bug

https://github.com/openNAMU/openNAMU/issues/1700
잉여개발기 (SPDV) 3 years ago
parent
commit
8c3ca860a5
3 changed files with 12 additions and 3 deletions
  1. 6 1
      app.py
  2. 5 1
      route/tool/func_tool.py
  3. 1 1
      version.json

+ 6 - 1
app.py

@@ -147,7 +147,12 @@ with get_db_connect() as conn:
 
     # Init-Route
     class EverythingConverter(werkzeug.routing.PathConverter):
-        regex = r'.*?'
+        def __init__(self, map):
+            super(EverythingConverter, self).__init__(map)
+            self.regex = r'.*?'
+
+        def to_python(self, value):
+            return re.sub(r'^\\\.', '.', value)
 
     class RegexConverter(werkzeug.routing.BaseConverter):
         def __init__(self, url_map, *items):

+ 5 - 1
route/tool/func_tool.py

@@ -58,7 +58,11 @@ def ip_or_user(data = ''):
         return 0
 
 def url_pas(data):
-    return urllib.parse.quote(data).replace('/','%2F')
+    data = re.sub(r'^\.', '\\\\.', data)
+    data = urllib.parse.quote(data)
+    data = data.replace('/','%2F')
+
+    return data
 
 def sha224_replace(data):
     return hashlib.sha224(bytes(data, 'utf-8')).hexdigest()

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.4.6-RC3-dev139",
+        "r_ver" : "v3.4.6-RC3-dev140",
         "c_ver" : "3500360",
         "s_ver" : "3500111"
     }