Project

General

Profile

Actions

Feature #8544

open

OpenURI should open 'file://' URIs

Added by silasdavis (Silas Davis) over 11 years ago. Updated almost 9 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:55558]

Description

The following code prints the contents of '/tmp/file.txt':

require 'open-uri'
open('/tmp/file.txt').read {|f| puts f.read }

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

However the following should produce the same output and is a URI, but fails:

open('file:///tmp/file.txt').read {|f| puts f.read }

I note that the documentation 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 in this RFC: http://tools.ietf.org/html/rfc1630. This coupled with the fact that it already does open files, but not by a URI specification.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0