Skip to content

Commit 2c83bef

Browse files
pxsitCopilot
andauthored
Update cms/server/contest/handlers/main.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f287c31 commit 2c83bef

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

cms/server/contest/handlers/main.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,13 @@ def post(self):
222222
if split.scheme or split.netloc or not split.path.startswith("/"):
223223
next_page = self.contest_url()
224224
elif split.path != "/":
225-
next_page = self.url(*split.path.strip("/").split("/"))
226-
if split.query:
227-
next_page += "?" + split.query
225+
path_segments = split.path.strip("/").split("/")
226+
if any(segment in ("", ".", "..") for segment in path_segments):
227+
next_page = self.contest_url()
228+
else:
229+
next_page = self.url(*path_segments)
230+
if split.query:
231+
next_page += "?" + split.query
228232
else:
229233
next_page = self.url()
230234
else:

0 commit comments

Comments
 (0)