-
Notifications
You must be signed in to change notification settings - Fork 294
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
Adds support to filepath_from_url
to support non-encoded URLs
#1664
Adds support to filepath_from_url
to support non-encoded URLs
#1664
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1664 +/- ##
==========================================
+ Coverage 79.84% 79.85% +0.01%
==========================================
Files 197 197
Lines 21751 21763 +12
Branches 4350 4353 +3
==========================================
+ Hits 17366 17378 +12
Misses 2232 2232
Partials 2153 2153
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
9617fb0
to
14bad85
Compare
Signed-off-by: Doug Halley <[email protected]>
14bad85
to
fc0900f
Compare
Signed-off-by: Doug Halley <[email protected]>
Looking at the documentation (https://docs.python.org/3/library/urllib.request.html) , and searching error reports, it seems pretty clear that the urllib has not had a lot of attention around aspects such as drive letters and windows specific encodings. It's disappointing that we need to do this, but I think it's necessary. Have you filed any issues with urllib around this, as the problem does seem to lie at their end. We should not gate merging this PR on such resolution, but it seems like something needs to happen upstream for the benefit of all. |
Now that we've left python 2 behind I think we could start using pathlib for some of this as well. |
@meshula, now that you mention it you're right this is a I looked through the cpython repo and found these open tickets that seem to relate to this very issue:
Since this issue with |
@apetrynet, what were you thinking about using |
Signed-off-by: Doug Halley <[email protected]>
Signed-off-by: Doug Halley <[email protected]>
…sts to operate successfully in CI/CD Signed-off-by: Doug Halley <[email protected]>
…ath_from_url` Signed-off-by: Doug Halley <[email protected]>
Signed-off-by: Doug Halley <[email protected]>
I was thinking about some windows path handling, but looking at it I'm not sure it'll help in this case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've provided a suggestion for an alternative way of dealing with this. I'm not sure if it's any cleaner, but I try to rely on the builtin modules to resolve this correctly. Should hopefully adapt to the underlying OS
Signed-off-by: Doug Halley <[email protected]>
Signed-off-by: Doug Halley <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call on the comments!
I have a couple of minor requests.
Signed-off-by: Doug Halley <[email protected]>
Signed-off-by: Doug Halley <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @douglascomet !
LGTM
filepath_from_url
works for encoded URLs but not for URLs that are not encoded. I encountered this when working with URLs from both.xml
and.aaf
files.The
.xml
file came from Premiere and encoded the URL while the.aaf
came from Avid and the URL was not encoded.Examples:
"file://localhost/S%3a/path/file.ext"
->"S:/path/file.ext"
"file://S:/path/file.ext"
->"/path/file.ext"
My PR updates the code to return the same result with both of the example URLs:
"file://localhost/S%3a/path/file.ext"
->"S:/path/file.ext"
"file://S:/path/file.ext"
->"S:/path/file.ext"
I tested and dev-ed this on Windows with OTIO
0.15.0
and0.16.0.dev1
.