diff --git a/requirements.txt b/requirements.txt index 77bfad8a..f60a29f0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -60,4 +60,3 @@ werkzeug==3.1.2 # flask # flask-cors -opengeodeweb-microservice==1.*,>=1.1.1 diff --git a/src/opengeodeweb_back/utils_functions.py b/src/opengeodeweb_back/utils_functions.py index 6df55ca3..7f2e95af 100644 --- a/src/opengeodeweb_back/utils_functions.py +++ b/src/opengeodeweb_back/utils_functions.py @@ -333,5 +333,5 @@ def generate_native_viewable_and_light_viewable_from_file( data_path = create_data_folder_from_id(data.id) full_input_filename = geode_functions.upload_file_path(input_file) geode_object = generic_geode_object.load(full_input_filename) - geode_object.builder().set_name(input_file) + geode_object.builder().set_name(os.path.splitext(input_file)[0]) return save_all_viewables_and_return_info(geode_object, data, data_path) diff --git a/tests/data/cube.test.og_brep b/tests/data/cube.test.og_brep new file mode 100644 index 00000000..9db99921 Binary files /dev/null and b/tests/data/cube.test.og_brep differ diff --git a/tests/test_utils_functions.py b/tests/test_utils_functions.py index 78b12659..2d662f57 100644 --- a/tests/test_utils_functions.py +++ b/tests/test_utils_functions.py @@ -207,6 +207,7 @@ def test_generate_native_viewable_and_light_viewable_from_file( ) assert isinstance(result, dict) + assert result["name"] == "test" assert isinstance(result["native_file"], str) assert result["native_file"] == "native.og_brep" assert isinstance(result["viewable_file"], str) @@ -217,6 +218,17 @@ def test_generate_native_viewable_and_light_viewable_from_file( assert isinstance(result["binary_light_viewable"], str) +def test_generate_native_viewable_and_light_viewable_from_file_with_multi_dots( + client: FlaskClient, +) -> None: + app = client.application + with app.app_context(): + result = utils_functions.generate_native_viewable_and_light_viewable_from_file( + GeodeBRep.geode_object_type(), "cube.test.og_brep" + ) + assert result["name"] == "cube.test" + + def test_send_file_multiple_returns_zip(client: FlaskClient, tmp_path: Path) -> None: app = client.application with app.app_context():