Use File.join rather than URI.join
Using File.join
is safer than URI.join
, so the relative path
does not get overridden.
There was a problem when an application had a relative path.
Say, for instance, an application was running on https://test.app/relative
.
When Chemlab attempted to navigate to a page, it was take the /relative
path portion out because of the way URI.join
behaves.
PoC:
$ irb
> URI.join('https://test.app/relative', '/path').to_s #=> https://test.app/path
> File.join('https://test.app/relative', '/path').to_s #=> https://test.app/relative/path
Edited by Dan Davison