You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bundle catalog add rewrites Windows drive paths as POSIX paths #5204
_is_local_path() explicitly recognizes a Windows drive path such as C:\catalog.json, but _canonicalize_url() then passes it to the host-native Path(...).resolve(). On Linux and macOS that turns the Windows absolute path
into a path relative to the current project, and add_source() persists the
rewritten value into the catalog configuration.
File: src/specify_cli/bundles/catalog_config.py:96-116
(_is_local_path, _canonicalize_url), used by add_source() at :184
Expected behavior
A Windows absolute path is either preserved verbatim in the configuration or
rejected as non-local on a POSIX host. It must not be silently rewritten into a
different path.
The Windows-drive branch is platform-independent, while Path is host-native.
On POSIX, Path(r"C:\catalog.json").resolve() produces <cwd>/C:\catalog.json; on Windows it would be absolute. The same function is
reached from the public bundle catalog add path through add_source().
Impact
A catalog configuration produced on Windows and consumed on Linux/macOS (or a
Windows path passed on a POSIX host) is silently corrupted instead of being
rejected.
The stored catalog id (c---catalog) and URL both diverge from the user's
input, and the source cannot be loaded.
Suggested fix
Preserve Windows drive paths on non-Windows hosts instead of resolving them
with the host-native Path:
def_canonicalize_url(url: str) ->str:
if_WINDOWS_DRIVE_RE.match(url):
returnurl# do not reinterpret on POSIXif_is_local_path(url):
returnstr(Path(url).expanduser().resolve())
returnurl
or canonicalize with PureWindowsPath when the host is POSIX and the input
matches the Windows-drive form, and reject the value if it cannot be resolved.
Activity