Project

General

Profile

Actions

Bug #3594

closed

URI class doesn't do file URL's properly.

Added by NeilW (Neil Wilson) over 13 years ago. Updated over 6 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
[ruby-core:31397]

Description

=begin
URI doesn't seem to output file URLs properly where there is an absolute path part.

For example.

require 'uri'

my_url = URI.parse("file:///var/lib/libvirt/images/")
p my_url.to_s

"file:/var/lib/libvirt/images/"

The double slash '//' should always appear according to the file URL specification.
=end

Actions #1

Updated by akr (Akira Tanaka) almost 13 years ago

  • Project changed from Ruby to Ruby master
  • Assignee set to akira (akira yamada)
Actions #2

Updated by shyouhei (Shyouhei Urabe) about 12 years ago

  • Status changed from Open to Assigned

Updated by mame (Yusuke Endoh) over 11 years ago

  • Description updated (diff)

Is this specified in RFC or any spec?

--
Yusuke Endoh

Updated by naruse (Yui NARUSE) over 11 years ago

mame (Yusuke Endoh) wrote:

Is this specified in RFC or any spec?

There's no available RFC of file URI scheme.

see also:

Updated by mame (Yusuke Endoh) over 6 years ago

RFC 8089 (The "file" URI Scheme) has been published in 2017. It says:

      file-URI       = file-scheme ":" file-hier-part

      file-scheme    = "file"

      file-hier-part = ( "//" auth-path )
                     / local-path

      auth-path      = [ file-auth ] path-absolute

      local-path     = path-absolute

and RFC 3986 says:

      path-absolute = "/" [ segment-nz *( "/" segment ) ]

So, "file:/var/lib/libvirt/images/" does not conform the spec, I think.

The maintainer of lib/uri.rb is Akira Yamada, who seems inactive. Does anyone want to investigate and fix this issue?

Updated by mame (Yusuke Endoh) over 6 years ago

  • Status changed from Assigned to Rejected

Sorry, I misread the spec. The URI is valid because it can be interpreted as file-scheme ":" local-path. So, there is no problem. Closing.

Updated by naruse (Yui NARUSE) over 6 years ago

  • Status changed from Rejected to Closed

I found the description in URL spec.
Therefore I fixed it at r60970.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0