File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
src/py-opentimelineio/opentimelineio Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,13 @@ def filepath_from_url(urlstr):
7676 elif pathlib .PureWindowsPath (filepath .parts [0 ]).drive :
7777 filepath = pathlib .PurePosixPath (filepath .drive , * filepath .parts [1 :])
7878
79+
7980 # If the specified index is a windows drive, then offset the path
80- elif pathlib .PureWindowsPath (filepath .parts [1 ]).drive :
81+ elif (
82+ # relative paths may not have a parts[1]
83+ len (filepath .parts ) > 1
84+ and pathlib .PureWindowsPath (filepath .parts [1 ]).drive
85+ ):
8186 # Remove leading "/" if/when `request.url2pathname` yields
8287 # "/S:/path/file.ext"
8388 filepath = pathlib .PurePosixPath (* filepath .parts [1 :])
Original file line number Diff line number Diff line change @@ -79,6 +79,14 @@ def test_posix_urls(self):
7979 processed_url = otio .url_utils .filepath_from_url (url )
8080 self .assertEqual (processed_url , POSIX_PATH )
8181
82+ def test_relative_url (self ):
83+ # see github issue #1817 - when a relative URL has only one name after
84+ # the "." (ie ./blah but not ./blah/blah)
85+ self .assertEqual (
86+ otio .url_utils .filepath_from_url (os .path .join ("." , "docs" )),
87+ "docs" ,
88+ )
89+
8290
8391if __name__ == "__main__" :
8492 unittest .main ()
You can’t perform that action at this time.
0 commit comments