Skip to content

Commit

Permalink
Add a TODO to remove eval
Browse files Browse the repository at this point in the history
  • Loading branch information
tagliala committed Apr 21, 2024
1 parent 27c1df4 commit a938e65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
13 changes: 0 additions & 13 deletions .rubocop_todo.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/sharepoint/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,14 @@ def uri_unescape(uri)
URI::DEFAULT_PARSER.unescape(uri.gsub('%5B', '[').gsub('%5D', ']'))
end

# TODO: Try to remove `eval` from this method. Otherwise, fix offenses
# rubocop:disable Security/Eval, Style/DocumentDynamicEvalDefinition, Style/EvalWithLocation, Style/PercentLiteralDelimiters
def string_unescape(s)
s.gsub!(/\\(?:[abfnrtv])/, '') # remove control chars
s.gsub!('"', '\"') # escape double quotes
eval %Q{"#{s}"}
end
# rubocop:enable Security/Eval, Style/DocumentDynamicEvalDefinition, Style/EvalWithLocation, Style/PercentLiteralDelimiters

def utf8_encode(s)
s.force_encoding('UTF-8') unless s.nil?
Expand Down

0 comments on commit a938e65

Please sign in to comment.