From 9098a71fab2b89a68b54b03e53f59f76da3f005b Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Fri, 9 May 2025 16:26:20 +0200 Subject: [PATCH] Only require what is needed from `cgi` In ruby 3.5 most of the functionality will require adding cgi as a dependency. Only escape/unescape functions will remain, which is all that's needed here. So just use that functionality from `erb`. https://bugs.ruby-lang.org/issues/21258. --- lib/simplecov-html.rb | 1 - views/source_file.erb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/simplecov-html.rb b/lib/simplecov-html.rb index a215f0f..cd07425 100644 --- a/lib/simplecov-html.rb +++ b/lib/simplecov-html.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "erb" -require "cgi" require "fileutils" require "digest/sha1" require "time" diff --git a/views/source_file.erb b/views/source_file.erb index e4f3a71..a8f753b 100644 --- a/views/source_file.erb +++ b/views/source_file.erb @@ -48,7 +48,7 @@ <% end %> <% end %> - <%= CGI.escapeHTML(line.src.chomp) %> + <%= ERB::Util.html_escape(line.src.chomp) %> <% end %>