Skip to content

Commit

Permalink
Add documentation for "Invalid filename" error
Browse files Browse the repository at this point in the history
And link to it in the error message.
  • Loading branch information
uranusjr committed Apr 19, 2022
1 parent 99d1917 commit b14eff7
Show file tree
Hide file tree
Showing 3 changed files with 317 additions and 259 deletions.
8 changes: 5 additions & 3 deletions warehouse/forklift/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1256,11 +1256,13 @@ def file_upload(request):
#
# [1] https://packaging.python.org/specifications/binary-distribution-format/
if not parsed_filename_parts[0] == project.normalized_name:
escaped_normalized_project_name = project.normalized_name.replace("-", "_")
help_url = request.help_url(_anchor="invalid-file-name")
raise _exc_with_message(
HTTPBadRequest,
"Invalid filename: Start filename for project {!r} with {!r}.".format(
project.name, project.normalized_name.replace("-", "_")
),
f"Invalid filename: Start filename for project {project.name!r} "
f"with {escaped_normalized_project_name!r}. "
f"See {help_url} for more information",
)

# Check the content type of what is being uploaded
Expand Down
Loading

0 comments on commit b14eff7

Please sign in to comment.