Skip to content

Commit

Permalink
Add path sanitization missing step in some DataSources methods. (#2054)
Browse files Browse the repository at this point in the history
* Add path sanitization missing step in some DataSources methods.

* Fix docstring for DataSources.set_result_file_path

* Fix docstring for DataSources.set_result_file_path
  • Loading branch information
PProfizi authored Feb 5, 2025
1 parent acffb5f commit fab9c63
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ansys/dpf/core/data_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,11 @@ def set_result_file_path(self, filepath, key=""):
>>> data_sources = dpf.DataSources()
>>> data_sources.set_result_file_path('/tmp/file.rst')
>>> data_sources.result_files
['/tmp/file.rst']
['...tmp...file.rst']
"""
extension = Path(filepath).suffix
filepath = Path(filepath)
extension = filepath.suffix
# Handle .res files from CFX
if key == "" and extension == ".res":
key = "cas"
Expand Down Expand Up @@ -199,6 +200,7 @@ def set_domain_result_file_path(
>>> data_sources.set_domain_result_file_path('/tmp/file1.sub', 1)
"""
path = Path(path)
if key:
self._api.data_sources_set_domain_result_file_path_with_key_utf8(
self, str(path), key, domain_id
Expand Down

0 comments on commit fab9c63

Please sign in to comment.