This is an automated email from the ASF dual-hosted git repository. wave pushed a commit to branch comment-out-file_name-in-uploads in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit dfc70f758c45ea4298b930a0349a2da7662e5421 Author: Dave Fisher <[email protected]> AuthorDate: Tue Mar 10 09:40:23 2026 -0700 Drop file_name field in upload files --- atr/post/upload.py | 7 +++++-- atr/shared/upload.py | 12 ++++++------ atr/storage/writers/release.py | 22 +++++++++++----------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/atr/post/upload.py b/atr/post/upload.py index 930eda14..0b39d78e 100644 --- a/atr/post/upload.py +++ b/atr/post/upload.py @@ -194,13 +194,16 @@ async def _add_files( version_name: safe.VersionName, ) -> web.WerkzeugResponse: try: - file_name = add_form.file_name + # file_name = add_form.file_name file_data = add_form.file_data async with storage.write(session) as write: wacp = await write.as_project_committee_participant(project_name) + # creation_error, number_of_files, was_quarantined = await wacp.release.upload_files( + # project_name, version_name, file_name, file_data + # ) creation_error, number_of_files, was_quarantined = await wacp.release.upload_files( - project_name, version_name, file_name, file_data + project_name, version_name, file_data ) if creation_error is not None: diff --git a/atr/shared/upload.py b/atr/shared/upload.py index 033c97f6..f1ad1eab 100644 --- a/atr/shared/upload.py +++ b/atr/shared/upload.py @@ -34,13 +34,13 @@ class SvnArea(enum.Enum): class AddFilesForm(form.Form): variant: ADD_FILES = form.value(ADD_FILES) file_data: form.FileList = form.label("Files", "Select the files to upload.") - file_name: form.Filename = form.label( - "File name", - "Optional: Enter a file name to use when saving the file in the release candidate. " - "Only available when uploading a single file.", - ) + # file_name: form.Filename = form.label( + # "File name", + # "Optional: Enter a file name to use when saving the file in the release candidate. " + # "Only available when uploading a single file.", + # ) - @pydantic.field_validator("file_name", mode="after") + # @pydantic.field_validator("file_name", mode="after") @classmethod def validate_file_name_with_files(cls, value: form.Filename, info: pydantic.ValidationInfo) -> form.Filename: # We can only get file_data if it comes before this field diff --git a/atr/storage/writers/release.py b/atr/storage/writers/release.py index 443dd8e0..7483dbba 100644 --- a/atr/storage/writers/release.py +++ b/atr/storage/writers/release.py @@ -505,7 +505,7 @@ class CommitteeParticipant(FoundationCommitter): self, project_name: safe.ProjectName, version_name: safe.VersionName, - file_name: pathlib.Path | None, + # file_name: pathlib.Path | None, files: Sequence[datastructures.FileStorage], ) -> tuple[str | None, int, bool]: """Process and save the uploaded files into a new draft revision.""" @@ -517,16 +517,16 @@ class CommitteeParticipant(FoundationCommitter): for file in files: # Determine the target path within the new revision directory relative_file_path: pathlib.Path - if not file_name: - if not file.filename: - raise storage.AccessError("No filename provided") - # Validate the filename from multipart upload - validated_path = form.to_relpath(file.filename) - if validated_path is None: - raise storage.AccessError("Invalid filename") - relative_file_path = validated_path - else: - relative_file_path = file_name + # if not file_name: + if not file.filename: + raise storage.AccessError("No filename provided") + # Validate the filename from multipart upload + validated_path = form.to_relpath(file.filename) + if validated_path is None: + raise storage.AccessError("Invalid filename") + relative_file_path = validated_path + # else: + # relative_file_path = file_name # Construct path inside the new revision directory target_path = path / relative_file_path --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
