Skip to content

Commit

Permalink
Keep the existance behavior with symlink path
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Aug 17, 2019
1 parent 273f1f4 commit 22d9bd9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/rubygems/core_ext/kernel_require.rb
Expand Up @@ -39,8 +39,10 @@ def require(path)
resolved_path = begin
rp = nil
$LOAD_PATH[0...Gem.load_path_insert_index || -1].each do |lp|
safe_lp = lp.dup.untaint
next if File.symlink? safe_lp
Gem.suffixes.each do |s|
full_path = File.expand_path(File.join(lp, "#{path}#{s}").untaint)
full_path = File.expand_path(File.join(safe_lp, "#{path}#{s}"))
if File.file?(full_path)
rp = full_path
break
Expand Down

0 comments on commit 22d9bd9

Please sign in to comment.