uri starting with file:// were not interpreted correctly#1874
uri starting with file:// were not interpreted correctly#1874
Conversation
| uri = string.strip(uri) | ||
| (scheme,netloc,path,parameters,query,fragment)=urlparse.urlparse(uri) | ||
| if scheme in ('','file'): | ||
| if uri[:7].lower() == "file://": |
There was a problem hiding this comment.
python does not have method load from file:// directly?
There was a problem hiding this comment.
@aashish24 Nope, Python doesn't support arbitrary open on URLs like PHP.
There was a problem hiding this comment.
@chaosphere2112 I thouught that urllib would have something .. but this code is fine.
There was a problem hiding this comment.
@aashish24 first off it's cdms open not python open.
Second we are using:
(scheme,netloc,path,parameters,query,fragment)=urlparse.urlparse(uri)
but if it starts with file:// then path and root are both empty strings.
There was a problem hiding this comment.
@chaosphere2112 I'm not 100% sure how the file:// got appended to the uri in the first place... I have a vague recollection of you asking me to do this forthe GUI so I'll take the blame. But it might be worth tracing down.
There was a problem hiding this comment.
but if it starts with file:// then path and root are both empty strings.
@doutriaux1 path should not be empty if you parse it via urlparse. I just did a local test to confirm this.
|
LGTM but will wait for travis to finish. |
|
@doutriaux1 @aashish24 Just pushed a commit that should help solidify this a bit. I tested with all kinds of gnarly paths ("file://../../blah/test.nc", for example), which works. I also made it so we convert paths to absolute paths in the CdmsFile constructor before converting them to file URIs. |
|
@chaosphere2112 can you add a test as well? |
|
Thanks @chaosphere2112 |
|
@chaosphere2112 @aashish24 ready to go |
|
@doutriaux1 i pushed again to resolve the conflict. |
|
I am running it manually as well. |
|
LGTM 👍 and worked on my machine as well. merging. |
uri starting with file:// were not interpreted correctly
fix #1867
@aashish24 @danlipsa @chaosphere2112 quick review