We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 438fad2 commit 96000f6Copy full SHA for 96000f6
1 file changed
lib/pathname.rb
@@ -238,7 +238,11 @@ class Pathname
238
# If +path+ contains a NUL character (<tt>\0</tt>), an ArgumentError is raised.
239
#
240
def initialize(path)
241
- path = path.to_path if path.respond_to? :to_path
+ unless String === path
242
+ path = path.to_path if path.respond_to? :to_path
243
+ raise TypeError unless String === path
244
+ end
245
+
246
if path.include?("\0")
247
raise ArgumentError, "pathname contains \\0: #{path.inspect}"
248
end
0 commit comments