diff --git a/Gemfile b/Gemfile index 9e891a886..aacd8eb5f 100644 --- a/Gemfile +++ b/Gemfile @@ -92,7 +92,6 @@ gem "sassc-rails", "~> 2.1.2" # Integrate SassC-Ruby into Rails gem "sidekiq", "~> 6.1.2" # Sidekiq is used to process background jobs with the help of Redis gem "sidekiq-cron", "~> 1.1" # Allows execution of scheduled cron jobs as specific times gem "sidekiq-unique-jobs", "~> 6.0.25" # Ensures that Sidekiq jobs are unique when enqueued -gem "simpleidn", "~> 0.1" # Convert IDN domains to Punycode gem "sitemap_generator", "~> 6.1" # SitemapGenerator is a framework-agnostic XML Sitemap generator gem "slack-notifier", "~> 2.3" # A slim ruby wrapper for posting to slack webhooks gem "sprockets", "~> 4.0" # Sprockets is a Rack-based asset packaging system diff --git a/Gemfile.lock b/Gemfile.lock index b8360fc88..ff1a9b41e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -733,8 +733,6 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - simpleidn (0.1.1) - unf (~> 0.1.4) sitemap_generator (6.1.2) builder (~> 3.0) slack-notifier (2.3.2) @@ -964,7 +962,6 @@ DEPENDENCIES sidekiq-cron (~> 1.1) sidekiq-unique-jobs (~> 6.0.25) simplecov (= 0.17.1) - simpleidn (~> 0.1) sitemap_generator (~> 6.1) slack-notifier (~> 2.3) spring (~> 2.1) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6bfc13eea..7dcc73611 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -83,7 +83,8 @@ module ApplicationHelper return unless (image_url = url.presence || fallback_image) - Images::Optimizer.call(SimpleIDN.to_ascii(image_url), width: width, quality: quality, fetch_format: fetch_format) + normalized_url = Addressable::URI.parse(image_url).normalize.to_s + Images::Optimizer.call(normalized_url, width: width, quality: quality, fetch_format: fetch_format) end def optimized_image_tag(image_url, optimizer_options: {}, image_options: {}) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index d447d92f7..336b7d54b 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -214,7 +214,7 @@ RSpec.describe ApplicationHelper, type: :helper do end it "returns an ASCII domain for Unicode input" do - expect(helper.optimized_image_url("https://www.火.dev/image.png")).to include("https://www.xn--vnx.dev") + expect(helper.optimized_image_url("https://www.火.dev/IMAGE.png")).to include("https://www.xn--vnx.dev/IMAGE.png") end it "keeps an ASCII domain as ASCII" do diff --git a/vendor/cache/simpleidn-0.1.1.gem b/vendor/cache/simpleidn-0.1.1.gem deleted file mode 100644 index e071d614c..000000000 Binary files a/vendor/cache/simpleidn-0.1.1.gem and /dev/null differ