Skip to content

Commit f12421f

Browse files
authored
[Fixes #13802] Fixed copy action when the title contains the spaces (#13803)
* [Fixes #13802] sanitize the layer name during cloning operation * [Fixes #13802] sanitize the name also in raster during cloning
1 parent 1df44a6 commit f12421f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

geonode/upload/celery_tasks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
find_key_recursively,
6363
ImporterRequestAction as ira,
6464
)
65+
from geonode.upload.handlers.base import BaseHandler
6566

6667
logger = logging.getLogger("importer")
6768

@@ -811,7 +812,8 @@ def copy_dynamic_model(self, exec_id, actual_step, layer_name, alternate, handle
811812

812813
resource = resource.first()
813814

814-
new_dataset_alternate = create_alternate(resource.title, exec_id).lower()
815+
sanitized_title = BaseHandler().fixup_name(resource.title)
816+
new_dataset_alternate = create_alternate(sanitized_title, exec_id)
815817

816818
if settings.IMPORTER_ENABLE_DYN_MODELS:
817819
dynamic_schema = ModelSchema.objects.filter(name=alternate.split(":")[1])

geonode/upload/handlers/common/raster.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,8 @@ def copy_raster_file(exec_id, actual_step, layer_name, alternate, handler_module
614614
if not new_file_location["files"]:
615615
raise InvalidGeoTiffException("Could not determine the location of the copied file")
616616

617-
new_dataset_alternate = create_alternate(original_dataset.title, exec_id)
617+
sanitized_title = BaseHandler().fixup_name(original_dataset.title)
618+
new_dataset_alternate = create_alternate(sanitized_title, exec_id)
618619

619620
additional_kwargs = {
620621
"original_dataset_alternate": original_dataset.alternate,

0 commit comments

Comments
 (0)