Skip to content

Commit 94d059a

Browse files
jlklosCopilot
andauthored
Strip trailing periods
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent ae9cdfb commit 94d059a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/api/v2/handlers/payload_api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919

2020
def _validate_payload_extension(filename: str) -> None:
2121
"""Raise HTTPBadRequest if the file extension is on the server-side executable blocklist."""
22-
ext = os.path.splitext(filename)[1].lower()
22+
# Normalize the filename so the extension check reflects how it will be stored
23+
# on filesystems like Windows that ignore trailing dots and spaces.
24+
normalized = filename.rstrip(". ")
25+
ext = os.path.splitext(normalized)[1].lower()
2326
if ext in _BLOCKED_EXTENSIONS:
2427
raise web.HTTPBadRequest(reason=f"File type {ext!r} is not allowed as a payload")
2528

0 commit comments

Comments
 (0)