Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support to filepath_from_url for UNC paths and tests for UNC and posix paths #1674

Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Updated comment around .startswith('//')` check
Signed-off-by: Doug Halley <[email protected]>
douglascomet committed Feb 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 1ad7b7088b074a3cb41c148008fdb1d22418ac98
5 changes: 3 additions & 2 deletions src/py-opentimelineio/opentimelineio/url_utils.py
Original file line number Diff line number Diff line change
@@ -82,8 +82,9 @@ def filepath_from_url(urlstr):
# Paths of type: "file://host/share/path/to/file.ext" provide "host" as netloc
filepath = PurePath('//', parsed_result.netloc + decoded_parsed_path)

# When running `as_posix` the resulting path will have only 1 leading `/`,
# so we insert another `/` at the front of the string path and return it.
# Executing `as_posix` on Windows seems to generate a path with only
# 1 leading `/`, so we insert another `/` at the front of the string path
# to match Linux and Windows UNC conventions and return it.
conformed_filepath = filepath.as_posix()
if not conformed_filepath.startswith('//'):
conformed_filepath = '/' + conformed_filepath