Project

General

Profile

Actions

Bug #13154

closed

URI::Generic, == operator, normalize!

Added by deman_killer (Dmitry Sk) about 7 years ago. Updated over 2 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:79237]

Description

This two URI means the same:

uri1 = URI::parse '/1/2/3'
uri2 = URI::parse 'file:///1/2/3'

but uri1 == uri2 return false
it is cause of normalize! implementation that compare scheme this way:

if scheme && scheme != scheme.downcase
  set_scheme(self.scheme.downcase)
end

But nil scheme actually equivalent to file

Updated by phluid61 (Matthew Kerwin) about 7 years ago

Dmitry Sk wrote:

But nil scheme actually equivalent to file

Are you sure? I thought a URI::Generic object with a nil scheme is a relative reference. See: URI::Generic#merge and #relative?

Related: https://github.com/phluid61/file-uri

Actions #2

Updated by hsbt (Hiroshi SHIBATA) over 2 years ago

  • Tracker changed from Misc to Bug
  • Description updated (diff)
  • Backport set to 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN

Updated by jeremyevans0 (Jeremy Evans) over 2 years ago

  • Status changed from Open to Rejected

I agree with @phluid61 (Matthew Kerwin), plain path provided to URI.parse should not be treated as implicit file scheme. Such a change would break backwards compatibility for the methods mentioned, and I think URI.parse('http://foo/bar').merge(URI.parse('/1/2/3')) should result in #<URI::HTTP http://foo/1/2/3> and not #<URI::File file:///1/2/3>.

If you disagree, please submit an issue to https://github.com/ruby/uri/issues and @akira (akira yamada) can decide if the behavior should be changed.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0