Skip to content

Commit 7f96b06

Browse files
committed
name optional
1 parent f53c206 commit 7f96b06

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/opengeodeweb_back/utils_functions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,14 @@ def save_all_viewables_and_return_info(
215215
assert data.native_file is not None
216216
assert data.viewable_file is not None
217217
assert data.light_viewable_file is not None
218+
name = geode_object.identifier.name()
219+
if not name:
220+
name = data.native_file
218221
return {
219222
"native_file": data.native_file,
220223
"viewable_file": data.viewable_file,
221224
"id": data.id,
222-
"name": geode_object.identifier.name(),
225+
"name": name,
223226
"viewer_type": data.viewer_object,
224227
"binary_light_viewable": binary_light_viewable.decode("utf-8"),
225228
"geode_object_type": data.geode_object,

tests/test_geode_functions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ def test_input_output() -> None:
2626
if generic_geode_object.is_loadable(file_absolute_path).value() == 0.0:
2727
continue
2828
geode_object = generic_geode_object.load(file_absolute_path)
29-
data_name = geode_object.identifier.name()
29+
data_name = geode_object.identifier.name() or os.path.basename(
30+
file_absolute_path
31+
)
3032
if geode_object.is_viewable():
3133
viewable_file_path = geode_object.save_viewable(
3234
os.path.join(os.path.abspath(f"./output"), data_name)

0 commit comments

Comments
 (0)