From: Joseph Jones Date: 2015-12-17T21:13:24-07:00 Subject: [ruby-core:72344] [Ruby trunk - Feature #8544] OpenURI should open 'file://' URIs --567387e4_7c58fd05_16c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Joseph Jones liked your message with Boxer. On December 12, 2015 at 09:30= :03 MST, bokov.vlad=40gmail.com wrote:Issue =238544 has been updated by V= lad Bokov.I think the difference in =23relative=3F =23absolute=3F behavio= ur also points that absolute URI with =22file://=22 should be =22open=22-= able=60> URI.parse('file:///root').absolute=3F=3D> false> URI.parse('/roo= t').absolute=3F=3D> true=60----------------------------------------=46eat= ure =238544: OpenURI should open 'file://' URIshttps://bugs.ruby-lang.org= /issues/8544=23change-55497* Author: Silas Davis* Status: Open* Priority:= Normal* Assignee: ----------------------------------------The following = code prints the contents of '/tmp/file.txt':require 'open-uri'open('/tmp/= file.txt').read =7B=7Cf=7C puts f.read =7Dwhich although useful should pr= obably fail since a unix file path is not a URI, and therefore might shie= ld data problems in a systemHowever the following should produce the same= output and is a URI, but fails:open('file:///tmp/file.txt').read =7B=7Cf= =7C puts f.read =7DI note that the documentation for open-uri does explai= n that it is a wrapper for http, https, and ftp, but to deserve its name = it should open such URIs as specified in this R=46C: http://tools.ietf.or= g/html/rfc1630. This coupled with the fact that it already does open file= s, but not by a URI specification.-- https://bugs.ruby-lang.org/ --567387e4_7c58fd05_16c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Joseph Jones liked your message with Boxer.


= On December 12, 2015 at 09:30:03 MST, bokov.vlad=40gmail.com wrote:
<= blockquote type=3D=22cite=22 style=3D=22border-left-style:solid;border-wi= dth:1px;margin-left:0px;padding-left:10px;=22>Issue =238544 has been upda= ted by Vlad Bokov.


I think the difference in =23relative= =3F =23absolute=3F behaviour also points that absolute URI with =22file:/= /=22 should be =22open=22-able
=60> URI.parse('file:///root').absolu= te=3F
=3D> false
> URI.parse('/root').absolute=3F
=3D> tru= e=60

----------------------------------------
=46eature =23= 8544: OpenURI should open 'file://' URIs
https://bugs.ruby-lang.org/= issues/8544=23change-55497

* Author: Silas Davis
* Status= : Open
* Priority: Normal
* Assignee:
-------------------= ---------------------
The following code prints the contents of '/tm= p/file.txt':

require 'open-uri'
open('/tmp/file.txt').rea= d =7B=7Cf=7C puts f.read =7D

which although useful should prob= ably fail since a unix file path is not a URI, and therefore might shield= data problems in a system

However the following should produc= e the same output and is a URI, but fails:

open('file:///tmp/f= ile.txt').read =7B=7Cf=7C puts f.read =7D

I note that the docu= mentation for open-uri does explain that it is a wrapper for http, https,= and ftp, but to deserve its name it should open such URIs as specified i= n this R=46C: http://tools.ietf.org/html/rfc1630. This coupled with the f= act that it already does open files, but not by a URI specification.




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