Skip to content

Commit

Permalink
Fix NoneType handling
Browse files Browse the repository at this point in the history
  • Loading branch information
manukala6 committed Dec 11, 2023
1 parent 5cf90e2 commit 74e78bb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/routes/datasets/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,18 @@ async def append_to_version(
# For the background task, we only need the new source uri from the request
input_data = {"creation_options": deepcopy(default_asset.creation_options)}
input_data["creation_options"]["source_uri"] = request.source_uri
input_data["creation_options"]["layers"] = request.layers # TODO handle if None
# check if layers are provided and append to creation options
if input_data["creation_options"].get("layers"):
input_data["creation_options"]["layers"] = request.layers
background_tasks.add_task(
append_default_asset, dataset, version, input_data, default_asset.asset_id
)

# We now want to append the new uris to the existing ones and update the asset
update_data = {"creation_options": deepcopy(default_asset.creation_options)}
update_data["creation_options"]["source_uri"] += request.source_uri
update_data["creation_options"]["layers"] += request.layers # TODO replace failed layers with new layers
if input_data["creation_options"].get("layers"):
update_data["creation_options"]["layers"] += request.layers # TODO replace failed layers with new layers
await assets.update_asset(default_asset.asset_id, **update_data)

version_orm: ORMVersion = await versions.get_version(dataset, version)
Expand Down

0 comments on commit 74e78bb

Please sign in to comment.