diff --git a/src/routes/entity_CRUD/__init__.py b/src/routes/entity_CRUD/__init__.py index ec5026c3..2790327c 100644 --- a/src/routes/entity_CRUD/__init__.py +++ b/src/routes/entity_CRUD/__init__.py @@ -85,7 +85,6 @@ def create_dataset(): def multiple_components(): if not request.is_json: return Response("json request required", 400) - entity_type = 'dataset' try: component_request = request.json auth_helper = AuthHelper.configured_instance(current_app.config['APP_CLIENT_ID'], current_app.config['APP_CLIENT_SECRET']) @@ -105,6 +104,8 @@ def multiple_components(): if 'dataset_link_abs_dir' in dataset: if not os.path.exists(dataset['dataset_link_abs_dir']): return Response(f"The filepath specified with 'dataset_link_abs_dir' does not exist: {dataset['dataset_link_abs_dir']}", 500) + if not os.path.isdir(dataset['dataset_link_abs_dir']): + return Response(f"The filepath specified with 'dataset_link_abs_dir is not a directory: {dataset['dataset_link_abs_dir']}", 500) else: return Response("Required field 'dataset_link_abs_dir' is missing from dataset", 500) @@ -128,6 +129,7 @@ def multiple_components(): new_directory_path = ingest_helper.get_dataset_directory_absolute_path(dataset, requested_group_uuid, dataset['uuid']) logger.info( f"Creating a directory as: {new_directory_path} with a symbolic link to: {dataset['dataset_link_abs_dir']}") + os.makedirs(new_directory_path) os.symlink(dataset['dataset_link_abs_dir'], new_directory_path, True) else: return Response("Required field 'dataset_link_abs_dir' is missing from dataset", 500)