Skip to content

Commit

Permalink
remove unused enumerate and files field into LibraryContentsFileCreat…
Browse files Browse the repository at this point in the history
…ePayload
  • Loading branch information
arash77 committed Oct 1, 2024
1 parent 49b0796 commit b2ff40f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 10 additions & 2 deletions client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6092,8 +6092,11 @@ export interface components {
extended_metadata?: unknown;
/** File Type */
file_type?: unknown;
/** Files */
files?: string[] | null;
/**
* Files
* @default []
*/
files: unknown;
/**
* Filesystem Paths
* @default
Expand Down Expand Up @@ -13093,6 +13096,11 @@ export interface components {
extended_metadata?: Record<string, never> | null;
/** file type */
file_type?: string | null;
/**
* list of dictionaries containing the uploaded file fields
* @default []
*/
files: Record<string, never>[];
/**
* (only if upload_option is 'upload_paths' and the user is an admin) file paths on the Galaxy server to upload to the library, one file per line
* @default
Expand Down
4 changes: 4 additions & 0 deletions lib/galaxy/schema/library_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ class LibraryContentsFileCreatePayload(LibraryContentsCreatePayload):
None,
title="UUID of the dataset to upload",
)
files: List[Dict[str, Any]] = Field(
[],
title="list of dictionaries containing the uploaded file fields",
)

# uploaded file fields
model_config = ConfigDict(extra="allow")
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/webapps/galaxy/api/library_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ async def create_form(
if not files:
data = await request.form()
upload_files = []
for i, upload_file in enumerate(data.values()):
for upload_file in data.values():
if isinstance(upload_file, StarletteUploadFile):
with tempfile.NamedTemporaryFile(
dir=trans.app.config.new_file_path, prefix="upload_file_data_", delete=False
) as dest:
shutil.copyfileobj(upload_file.file, dest) # type: ignore[misc] # https://github.com/python/mypy/issues/15031
upload_file.file.close()
upload_files.append(dict(filename=upload_file.filename, local_filename=dest.name))
setattr(payload, "files", upload_files)
payload.files = upload_files

return self.service.create(trans, library_id, payload)

Expand Down

0 comments on commit b2ff40f

Please sign in to comment.