Skip to content

Commit

Permalink
Patched / conforming
Browse files Browse the repository at this point in the history
Signed-off-by: Doug Halley <[email protected]>
  • Loading branch information
douglascomet committed Feb 15, 2024
1 parent 403721c commit 39ff7db
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/py-opentimelineio/opentimelineio/url_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def url_from_filepath(fpath):
)


def filepath_from_url(urlstr):
def filepath_from_url(urlstr, as_posix=True):
"""
Take an url and return a filepath.
Expand Down Expand Up @@ -82,5 +82,12 @@ 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.
conformed_filepath = filepath.as_posix()
if conformed_filepath.startswith('/'):
conformed_filepath = '/' + conformed_filepath
return conformed_filepath

# Convert "\" to "/" if needed
return filepath.as_posix()

0 comments on commit 39ff7db

Please sign in to comment.