Skip to content

Commit

Permalink
security warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ahujaak committed Nov 5, 2024
1 parent 8aee296 commit 4277540
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/query_helper/sql_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ def update(sql)

def remove_comments
# Remove SQL inline comments (/* */) and line comments (--)
@sql = @sql.gsub(%r{/\*.*?\*/}m, '') # Removes multi-line comments (/* ... */)
.gsub(/--[^\n]*$/, '') # Removes single-line comments (-- ... until end of line)
@sql = @sql.gsub(%r{/\*[^/]*?\*/}m, '') # Removes multi-line comments (/* ... */)
.gsub(/--[^\n]*/, '') # Removes single-line comments (--)

@sql.squish!
end

Expand Down

0 comments on commit 4277540

Please sign in to comment.