Skip to content

Commit

Permalink
fix: resolve Windows path handling in _find_config
Browse files Browse the repository at this point in the history
* Replace Path.match("/") with Path.anchor comparison
* Fix infinite loop in _studio.py path traversal
  • Loading branch information
Julfried committed Jan 27, 2025
1 parent 87554bb commit e82a796
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sagemaker/_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def _find_config(working_dir=None):
wd = Path(working_dir) if working_dir else Path.cwd()

path = None
while path is None and not wd.match("/"):

root = Path(wd.anchor) # Properly get the root of the current working directory for both Windows and Unix-like systems
while path is None and wd != root:
candidate = wd / STUDIO_PROJECT_CONFIG
if Path.exists(candidate):
path = candidate
Expand Down

0 comments on commit e82a796

Please sign in to comment.