diff options
Diffstat (limited to 'lib/redmine/utils.rb')
-rw-r--r-- | lib/redmine/utils.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/redmine/utils.rb b/lib/redmine/utils.rb index 3e44b6359..cfdb4d15d 100644 --- a/lib/redmine/utils.rb +++ b/lib/redmine/utils.rb @@ -41,5 +41,15 @@ module Redmine SecureRandom.hex(n) end end + + module Shell + def shell_quote(str) + if Redmine::Platform.mswin? + '"' + str.gsub(/"/, '\\"') + '"' + else + "'" + str.gsub(/'/, "'\"'\"'") + "'" + end + end + end end end |