fix: uploaded files with no extension become permanently unresolvable (#1275)

* fix: accept extensionless upload ids so files like Dockerfile resolve

* test: upload id validation accepts extensionless ids
This commit is contained in:
Afonso Coutinho
2026-06-02 17:16:30 +01:00
committed by GitHub
parent f62d6ea3d7
commit a3b3dbafde
2 changed files with 26 additions and 1 deletions

View File

@@ -31,7 +31,11 @@ import logging
logger = logging.getLogger(__name__)
UPLOAD_ID_RE = re.compile(r"^[0-9a-fA-F]{32}\.[A-Za-z0-9]+$")
# The extension is optional: save_upload builds the id as `{uuid.hex}{ext}`,
# and a file with no extension (Dockerfile, README, ...) yields a bare 32-hex
# id. Requiring `.ext` made those ids fail validation, so the stored file
# could never be resolved or downloaded again.
UPLOAD_ID_RE = re.compile(r"^[0-9a-fA-F]{32}(?:\.[A-Za-z0-9]+)?$")
def is_valid_upload_id(upload_id: str) -> bool: