Skip to content

Commit bfb0f4b

Browse files
committed
Fail if more than one default filename is present for a property
1 parent cbdf074 commit bfb0f4b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ogc/bblocks/models.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,18 @@ def _find_path_or_url(self, metadata_property: str,
133133
else:
134134
result.append(self.files_path.joinpath(ref).resolve())
135135

136-
if not result:
136+
if not result and default_filenames:
137137
result = [default_filenames[0]]
138+
found_def_fn = False
138139
for fn in default_filenames:
139140
f = self.files_path / fn
140141
if f.is_file():
142+
if found_def_fn:
143+
raise ValueError(f"Found multiple default files ({result[0]}, {f}) "
144+
f"for the '{metadata_property}' metadata property. "
145+
f"This is usually not intended and can lead to confusion.")
141146
result[0] = f
142-
break
147+
found_def_fn = True
143148

144149
if not result:
145150
return None

0 commit comments

Comments
 (0)