We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
filepath_from_url
1 parent f6a3a9b commit fc0900fCopy full SHA for fc0900f
src/py-opentimelineio/opentimelineio/url_utils.py
@@ -40,4 +40,17 @@ def filepath_from_url(urlstr):
40
""" Take a url and return a filepath """
41
42
parsed_result = urlparse.urlparse(urlstr)
43
- return request.url2pathname(parsed_result.path)
+
44
+ # Check if original urlstr is URL encoded
45
+ if urlparse.unquote(urlstr) != urlstr:
46
+ filepath = request.url2pathname(parsed_result.path)
47
48
+ # Otherwise, combine the netloc and path
49
+ else:
50
+ filepath = parsed_result.netloc + parsed_result.path
51
52
+ # If on Windows, remove the first leading slash left by urlparse
53
+ if os.name == 'nt' and filepath.startswith('/'):
54
+ filepath = filepath[1:]
55
56
+ return filepath
0 commit comments