spacetx / slicedimage

MIT License
7 stars 3 forks source link

Fix Windows path resolution #112

Closed ttung closed 5 years ago

ttung commented 5 years ago

When extracting the path component from urllib.parse.urlparse, the path always starts with '/'. When tokenizing the url into its components, it becomes '/', 'c:', 'windows', 'system32'. Unfortunately, when combined into a WindowsPath, it becomes 'c:windows/system32', which honestly makes no sense to me.

The approach here is to strip the prefix '/', and when we do that, WindowsPath can parse the posix path correctly.

Thanks to @dany-fu for reporting this.

Test plan: loaded up a very empty experiment.json on a Windows VM.

codecov-io commented 5 years ago

Codecov Report

Merging #112 into master will decrease coverage by 0.08%. The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #112      +/-   ##
==========================================
- Coverage   75.49%   75.41%   -0.09%     
==========================================
  Files          29       29              
  Lines         906      907       +1     
==========================================
  Hits          684      684              
- Misses        222      223       +1
Impacted Files Coverage Δ
slicedimage/url/resolve.py 72.09% <66.66%> (-1.72%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ba15786...c37a914. Read the comment docs.