Describe the bug
The _is_known_path helper function (introduced in #1294) by @crowecawcaw
fails to validate valid asset paths when deadline_known_asset_paths contains a UNC root configured at the host level (e.g., \\192.168.20.20), rather than including a share name (e.g., \\192.168.20.20\projects).
Root cause:
On Windows, os.path.commonpath([norm_root, norm_candidate]) internally invokes os.path.splitdrive():
os.path.splitdrive(r"\\192.168.20.20") treats \\192.168.20.20 as having an empty drive ("") because no share component is present.
os.path.splitdrive(r"\\192.168.20.20\projects\file.c4d") treats \\192.168.20.20\projects as the drive (r"\\192.168.20.20\projects").
Because commonpath detects two mismatched drives, it raises ValueError: Paths don't have the same drive. The except ValueError: block in _is_known_path catches this exception and returns False, causing valid asset paths under that server to fail validation.
This prevents us
Expected Behaviour
_is_known_path(candidate_path, known_roots) should evaluate to True when candidate_path is a child path residing under the host defined in known_roots.
Successful submission for files living on a Network Share in Windows with a \\<host> path
Current Behaviour
_is_known_path catches a ValueError during os.path.commonpath execution and returns False for all candidate paths under host-level UNC roots.
It prevents us from successfully submitting to deadline cloud
Reproduction Steps
Run the following script on Windows or using Python's ntpath:
import os
from pathlib import Path
def _is_known_path(path: Path | str, known_roots: list[Path | str]) -> bool:
norm_candidate = os.path.normpath(str(path))
for known_path in known_roots:
norm_root = os.path.normpath(str(known_path))
try:
if os.path.commonpath([norm_root, norm_candidate]) == norm_root:
return True
except ValueError:
continue
return False
# Setup
known_roots = [r"\\192.168.20.20"]
candidate_path = r"\\192.168.20.20\projects\assets\FA_Anim\260304_FA_Anim.c4d"
# Reproduction
result = _is_known_path(candidate_path, known_roots)
print(f"Result: {result}") # Prints False, expected True
Environment
- Windows
- Python 3.11
- deadline-cloud==0.6.3
Describe the bug
The
_is_known_pathhelper function (introduced in #1294) by @crowecawcawfails to validate valid asset paths when
deadline_known_asset_pathscontains a UNC root configured at the host level (e.g.,\\192.168.20.20), rather than including a share name (e.g.,\\192.168.20.20\projects).Root cause:
On Windows,
os.path.commonpath([norm_root, norm_candidate])internally invokesos.path.splitdrive():os.path.splitdrive(r"\\192.168.20.20")treats\\192.168.20.20as having an empty drive ("") because no share component is present.os.path.splitdrive(r"\\192.168.20.20\projects\file.c4d")treats\\192.168.20.20\projectsas the drive (r"\\192.168.20.20\projects").Because commonpath detects two mismatched drives, it raises ValueError: Paths don't have the same drive. The except ValueError: block in _is_known_path catches this exception and returns False, causing valid asset paths under that server to fail validation.
This prevents us
Expected Behaviour
_is_known_path(candidate_path, known_roots)should evaluate toTruewhen candidate_path is a child path residing under the host defined in known_roots.Successful submission for files living on a Network Share in Windows with a
\\<host>pathCurrent Behaviour
_is_known_pathcatches a ValueError duringos.path.commonpathexecution and returnsFalsefor all candidate paths under host-level UNC roots.It prevents us from successfully submitting to deadline cloud
Reproduction Steps
Run the following script on Windows or using Python's ntpath:
Environment