diff options
author | nagachika <nagachika@ruby-lang.org> | 2021-04-05 20:35:34 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2021-04-05 20:48:25 +0900 |
commit | 59cfa0b1346067e36ae11fc6c317693ce4b9833a (patch) | |
tree | 021b265720b501f26e9b134289949d4f04abfe48 /test | |
parent | b59e5a64be40b93370afbb0accfcb73c4d682045 (diff) | |
download | ruby-59cfa0b1346067e36ae11fc6c317693ce4b9833a.tar.gz |
Backport a tmpdir fix.
Remove other then alphanumeric and some punctuations considered
filesystem-safe, instead of removing some unsafe chars only.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_tmpdir.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/test_tmpdir.rb b/test/test_tmpdir.rb index 50583b5ce1..ea2cc123c1 100644 --- a/test/test_tmpdir.rb +++ b/test/test_tmpdir.rb @@ -86,6 +86,10 @@ class TestTmpdir < Test::Unit::TestCase traversal_path = Array.new(target.count('/')-2, '..').join('/') + traversal_path actual = yield traversal_path assert_not_send([File.absolute_path(actual), :start_with?, target]) + [File::SEPARATOR, File::ALT_SEPARATOR].compact.each do |separator| + actual = yield traversal_path.tr('/', separator) + assert_not_send([File.absolute_path(actual), :start_with?, target]) + end end end end |