mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix Encoding::CompatibilityError in FileUtils::Entry_#join
This commit is contained in:
parent
3a1e63e540
commit
6adbdb56ed
2 changed files with 9 additions and 4 deletions
|
@ -1557,7 +1557,15 @@ module FileUtils
|
||||||
def join(dir, base)
|
def join(dir, base)
|
||||||
return File.path(dir) if not base or base == '.'
|
return File.path(dir) if not base or base == '.'
|
||||||
return File.path(base) if not dir or dir == '.'
|
return File.path(base) if not dir or dir == '.'
|
||||||
File.join(dir, base)
|
begin
|
||||||
|
File.join(dir, base)
|
||||||
|
rescue EncodingError
|
||||||
|
if fu_windows?
|
||||||
|
File.join(dir.encode(::Encoding::UTF_8), base.encode(::Encoding::UTF_8))
|
||||||
|
else
|
||||||
|
raise
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if File::ALT_SEPARATOR
|
if File::ALT_SEPARATOR
|
||||||
|
|
|
@ -771,9 +771,6 @@ class TestFileUtils < Test::Unit::TestCase
|
||||||
|
|
||||||
remove_entry dir
|
remove_entry dir
|
||||||
assert_file_not_exist dir
|
assert_file_not_exist dir
|
||||||
rescue MiniTest::Assertion
|
|
||||||
STDERR.puts Dir.glob("#{dir}/**/*").inspect
|
|
||||||
raise
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_remove_entry_secure
|
def test_remove_entry_secure
|
||||||
|
|
Loading…
Add table
Reference in a new issue