diff --git a/app/routes/datasets/versions.py b/app/routes/datasets/versions.py index 6752edaaf..ebf022030 100644 --- a/app/routes/datasets/versions.py +++ b/app/routes/datasets/versions.py @@ -231,7 +231,9 @@ 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 ) @@ -239,7 +241,8 @@ async def append_to_version( # 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)