From d231b8f95b35d8a344cec4f62d7bbdf360a70e1c Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Mon, 22 Jun 2020 17:07:49 +0900 Subject: Fix remove_entry error when path encoding is not compatible UTF-8 --- test/fileutils/test_fileutils.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/fileutils/test_fileutils.rb') diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index a72cb6bc96..8a546ccf1b 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -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 -- cgit v1.2.3