Project

General

Profile

Bug #14429 ยป shellwords-plus.patch

jeremyevans0 (Jeremy Evans), 06/20/2019 08:26 PM

View differences:

lib/shellwords.rb
147 147
    # Treat multibyte characters as is.  It is the caller's responsibility
148 148
    # to encode the string in the right encoding for the shell
149 149
    # environment.
150
    str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/, "\\\\\\1")
150
    str.gsub!(/([^A-Za-z0-9_\-.,:+\/@\n])/, "\\\\\\1")
151 151

  
152 152
    # A LF cannot be escaped with a backslash because a backslash + LF
153 153
    # combo is regarded as a line continuation and simply ignored.
test/test_shellwords.rb
68 68
    assert_equal "ps -p #{$$}", joined
69 69
  end
70 70

  
71
  def test_shellescape
72
    assert_equal "''", shellescape('')
73
    assert_equal "\\^AZaz09_\\\\-.,:/@'\n'+\\'\\\"", shellescape("^AZaz09_\\-.,:\/@\n+'\"")
74
  end
75

  
71 76
  def test_whitespace
72 77
    empty = ''
73 78
    space = " "
74
-