mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
Fix remove_entry error when path encoding is not compatible UTF-8
This commit is contained in:
parent
48d7ebe6fc
commit
d231b8f95b
2 changed files with 22 additions and 1 deletions
|
@ -756,6 +756,23 @@ class TestFileUtils < Test::Unit::TestCase
|
|||
assert_file_not_exist dir
|
||||
end
|
||||
|
||||
def test_remove_entry_multibyte_path
|
||||
c = "\u00a7"
|
||||
begin
|
||||
c = c.encode('filesystem')
|
||||
rescue EncodingError
|
||||
c = c.b
|
||||
end
|
||||
dir = "tmpdir#{c}"
|
||||
my_rm_rf dir
|
||||
|
||||
Dir.mkdir dir
|
||||
File.write("#{dir}/#{c}.txt", "test_remove_entry_multibyte_path")
|
||||
|
||||
remove_entry dir
|
||||
assert_file_not_exist dir
|
||||
end
|
||||
|
||||
def test_remove_entry_secure
|
||||
check_singleton :remove_entry_secure
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue