Skip to content

Commit

Permalink
Fix static
Browse files Browse the repository at this point in the history
  • Loading branch information
BoryaGames authored Oct 21, 2024
1 parent d60355c commit 9c34d9b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cattopy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _maketemplate(self, path: str) -> str:
"^"
+ re.sub(
r"/{([a-zA-Z0-9_]+)}",
"/(?P<\\g<1>>[a-zA-Z0-9_]+)",
"/(?P<\\g<1>>[a-zA-Z0-9_\\.]+)",
path.replace("*", ".*"),
0,
)
Expand Down Expand Up @@ -176,7 +176,7 @@ def subdecorator(func: Callable[[Request], Awaitable[Response | type[Skip]]]):
def static(self, prefix: str, path: str):
async def _middleware(request: Request):
rootPath = os.path.abspath(path)
if request.path == prefix or request.path.startswith(prefix + "/"):
if request.path == prefix or request.path.startswith(re.sub(r"/+", "/", prefix + "/", 0)):
currentPath = os.path.join(
rootPath,
request.path.removeprefix(prefix)
Expand Down

0 comments on commit 9c34d9b

Please sign in to comment.