Skip to content

Commit

Permalink
Merge pull request #32 from frankus/patch-2
Browse files Browse the repository at this point in the history
Document requirement that path be escaped
  • Loading branch information
nurse authored May 12, 2022
2 parents 5b6bdab + ef79789 commit 92352e6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/uri/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class File < Generic
# 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'
Expand All @@ -44,6 +47,9 @@ class File < Generic
# :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)
Expand Down

0 comments on commit 92352e6

Please sign in to comment.