diff --git a/importer/handlers/common/raster.py b/importer/handlers/common/raster.py index a5cf853f..a7cdb404 100644 --- a/importer/handlers/common/raster.py +++ b/importer/handlers/common/raster.py @@ -504,6 +504,9 @@ def copy_raster_file( original_dataset = original_dataset.first() + if not original_dataset.files: + raise InvalidGeoTiffException("The original file of the dataset is not available, Is not possible to copy the dataset") + new_file_location = orchestrator.load_handler(handler_module_path).copy_original_file(original_dataset) new_dataset_alternate = create_alternate(original_dataset.title, exec_id) diff --git a/importer/migrations/0006_dataset_migration.py b/importer/migrations/0006_dataset_migration.py index 7623c713..651965f3 100644 --- a/importer/migrations/0006_dataset_migration.py +++ b/importer/migrations/0006_dataset_migration.py @@ -10,7 +10,13 @@ def dataset_migration(apps, _): .exclude(pk__in=NewResources.objects.values_list('resource_id', flat=True))\ .exclude(subtype__in=['remote', None]): # generating orchestrator expected data file - converted_files = [{"base_file": x} for x in old_resource.files] + if not old_resource.files: + if old_resource.is_vector(): + converted_files = [{"base_file": "placeholder.shp"}] + else: + converted_files = [{"base_file": "placeholder.tiff"}] + else: + converted_files = [{"base_file": x} for x in old_resource.files] # try to get the handler for the file of the old resource # when is found, we can exit handler_to_use = None