[ruby-core:92712] [Ruby trunk Feature#15861] Correctly parse `file:c:/path/to/file` URIs

From: merch-redmine@...
Date: 2019-05-18 15:37:23 UTC
List: ruby-core #92712
Issue #15861 has been updated by jeremyevans0 (Jeremy Evans).


Looking at RFC 8089, Appendix E (`Nonstandard Syntax Variations`) states: 

```
   These variations may be encountered by existing usages of the file
   URI scheme but are not supported by the normative syntax of
   Section 2.

   This appendix is not normative.
```

Appendix E.2 says that the following form is already supported: `file:///c:/path/to/file`.  Using that with the URI library:

```ruby
URI.parse("file:///c:/path/to/file").path
=> "/c:/path/to/file"
```

I can see where the preceding `/` may present an issue.  However, I am not sure whether we want to add support for nonstandard syntax variations to the `file` scheme.

----------------------------------------
Feature #15861: Correctly parse `file:c:/path/to/file` URIs
https://bugs.ruby-lang.org/issues/15861#change-78070

* Author: deivid (David Rodr刕uez)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
Recently ruby has getting better at parsing URIs using the "file" scheme, with the addition of "URI::File". Still, some Windows edge cases are not implemented, and it would be nice to have them. For example, while the [addressable gem](https://github.com/sporkmonger/addressable) can correct parse "file:c:/path/to/file", the builtin library is not that smart yet:

``` 
irb(main):001:0> URI.parse("file:c:/path/to/file").path
=> nil
irb(main):002:0> require 'addressable'
=> true
irb(main):003:0> Addressable::URI.parse("file:c:/path/to/file").path
=> "c:/path/to/file"
```

I think this would be a matter of implementing https://tools.ietf.org/html/rfc8089#appendix-E.2, which is not normative but it would be certainly nice to have.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next