Skip to content

Commit

Permalink
Add additional check on path existance
Browse files Browse the repository at this point in the history
  • Loading branch information
flferretti committed Nov 18, 2024
1 parent d8adde6 commit 53cbe10
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/adam/model/std_factories/std_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_xml_string(path: str | pathlib.Path):

# Checking if it is a path or an urdf
if not isPath:
if len(path) <= MAX_PATH:
if len(path) <= MAX_PATH and "<robot" not in path:
path = pathlib.Path(path)
isPath = True
else:
Expand All @@ -49,11 +49,7 @@ def get_xml_string(path: str | pathlib.Path):
break

if isPath:
if not path.is_file():
raise FileExistsError(path)

with path.open() as xml_file:
xml_string = xml_file.read()
xml_string = path.read_text()

if not isPath and not isUrdf:
raise ValueError(
Expand Down

0 comments on commit 53cbe10

Please sign in to comment.