Open
Description
As title says, currently #route_to
and #route_from
can be broken for file://
URI due to possible inconsistency of windows drive letter casing:
irb(main):001:0> require 'addressable/uri'
=> true
irb(main):002:0> Addressable::URI.convert_path("C:\\foo.txt").route_from(Addressable::URI.parse("file:///C:/bar.txt")).to_s
=> "../c:/foo.txt"
Relevant code in question is:
addressable/lib/addressable/uri.rb
Lines 290 to 293 in dd84176
There is a dirty workaround by calling .convert_path
on already parsed URI to apply the drive letter normalization to an already parsed URI like below:
irb(main):001:0> require 'addressable/uri'
=> true
irb(main):002:0> Addressable::URI.convert_path("C:\\foo.txt").route_from(Addressable::URI.convert_path(Addressable::URI.parse("file:///C:/bar.txt").path)).to_s
=> "foo.txt"
Metadata
Assignees
Labels
No labels
Activity