Skip to content

Commit b14eff7

Browse files
committed
Add documentation for "Invalid filename" error
And link to it in the error message.
1 parent 99d1917 commit b14eff7

File tree

3 files changed

+317
-259
lines changed

3 files changed

+317
-259
lines changed

warehouse/forklift/legacy.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1256,11 +1256,13 @@ def file_upload(request):
12561256
#
12571257
# [1] https://packaging.python.org/specifications/binary-distribution-format/
12581258
if not parsed_filename_parts[0] == project.normalized_name:
1259+
escaped_normalized_project_name = project.normalized_name.replace("-", "_")
1260+
help_url = request.help_url(_anchor="invalid-file-name")
12591261
raise _exc_with_message(
12601262
HTTPBadRequest,
1261-
"Invalid filename: Start filename for project {!r} with {!r}.".format(
1262-
project.name, project.normalized_name.replace("-", "_")
1263-
),
1263+
f"Invalid filename: Start filename for project {project.name!r} "
1264+
f"with {escaped_normalized_project_name!r}. "
1265+
f"See {help_url} for more information",
12641266
)
12651267

12661268
# Check the content type of what is being uploaded

0 commit comments

Comments
 (0)