ruby-changes:71804
From: Frank <ko1@a...>
Date: Thu, 12 May 2022 10:07:08 +0900 (JST)
Subject: [ruby-changes:71804] 054ae999dc (master): [ruby/uri] Update file.rb
https://git.ruby-lang.org/ruby.git/commit/?id=054ae999dc From 054ae999dc5dfcb182f407bffceec5a52ae7ff6c Mon Sep 17 00:00:00 2001 From: Frank Schmitt <frank@f...> Date: Tue, 15 Feb 2022 15:48:09 -0800 Subject: [ruby/uri] Update file.rb The module here is called `URI`, so it's probably reasonable to expect a requirement for the path to be RFC3986-compliant, but on the other hand, the class is called `File`, so it might be reasonable to expect that a path produced by e.g. the `File` class would be consumable by its `build` method (this fails if the filename contains e.g. a space). https://github.com/ruby/uri/commit/ef79789b83 --- lib/uri/file.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/uri/file.rb b/lib/uri/file.rb index 7671ad6470..4ff0bc097e 100644 --- a/lib/uri/file.rb +++ b/lib/uri/file.rb @@ -33,6 +33,9 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/file.rb#L33 # If an Array is used, the components must be passed in the # order <code>[host, path]</code>. # + # A path from e.g. the File class should be escaped before + # being passed. + # # Examples: # # require 'uri' @@ -44,6 +47,9 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/file.rb#L47 # :path => '/ruby/src'}) # uri2.to_s # => "file://host.example.com/ruby/src" # + # uri3 = URI::File.build({:path => URI::escape('/path/my file.txt')}) + # uri3.to_s # => "file:///path/my%20file.txt" + # def self.build(args) tmp = Util::make_components_hash(self, args) super(tmp) -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/