From aadd8396ccd1f5c6dde48df3048550dae237ca22 Mon Sep 17 00:00:00 2001 From: Dennis Schubert Date: Sun, 22 Jun 2025 14:04:29 +0200 Subject: [PATCH] Update open_graph_reader to 0.9.1 and set new config flag. closes #8465 --- Changelog.md | 1 + Gemfile | 2 +- Gemfile.lock | 14 +++++++------- config/initializers/open_graph_reader.rb | 11 ++++++----- features/support/webmock.rb | 2 +- spec/models/open_graph_cache_spec.rb | 2 +- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Changelog.md b/Changelog.md index af95e22c9..dd95153dc 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,7 @@ # 0.9.1.0 (unreleased) ## Refactor +* Improved compatibility with non-specification-compliant OpenGraph metadata [#8465](https://github.com/diaspora/diaspora/pull/8465) ## Bug fixes * Fix processing for a specific set of uploaded images, like scenes full of snow, by allowing for a larger on-disk cache for ImageMagick [#8460](https://github.com/diaspora/diaspora/pull/8460) diff --git a/Gemfile b/Gemfile index ae6873915..42c27b5b2 100644 --- a/Gemfile +++ b/Gemfile @@ -110,7 +110,7 @@ gem "leaflet-rails", "1.9.4" # Parsing gem "nokogiri", "1.16.5" -gem "open_graph_reader", "0.8.0" # also update User-Agent in features/support/webmock.rb and open_graph_cache_spec.rb +gem "open_graph_reader", "0.9.1" # also update User-Agent in features/support/webmock.rb and open_graph_cache_spec.rb gem "redcarpet", "3.6.0" gem "ruby-oembed", "0.17.0" gem "twitter-text", "3.1.0" diff --git a/Gemfile.lock b/Gemfile.lock index 6e66b67b1..fe39f2310 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -229,7 +229,7 @@ GEM http-cookie (~> 1.0.0) faraday-follow_redirects (0.3.0) faraday (>= 1, < 3) - faraday-net_http (3.1.0) + faraday-net_http (3.1.1) net-http faraday-retry (2.2.1) faraday (~> 2.0) @@ -390,7 +390,7 @@ GEM mime-types-data (3.2024.0507) mini_magick (4.12.0) mini_mime (1.1.5) - mini_portile2 (2.8.7) + mini_portile2 (2.8.9) minitest (5.23.1) mobile-fu (1.4.0) rack-mobile-detect @@ -402,7 +402,7 @@ GEM multipart-post (2.4.1) mysql2 (0.5.6) naught (1.1.0) - net-http (0.4.1) + net-http (0.6.0) uri net-imap (0.4.12) date @@ -454,7 +454,7 @@ GEM rack omniauth-wordpress (0.2.2) omniauth-oauth2 (>= 1.1.0) - open_graph_reader (0.8.0) + open_graph_reader (0.9.1) faraday (>= 0.9.0) nokogiri (~> 1.6) openid_connect (2.3.0) @@ -507,7 +507,7 @@ GEM puma (6.4.2) nio4r (~> 2.0) raabro (1.4.0) - racc (1.8.0) + racc (1.8.1) rack (2.2.9) rack-attack (6.7.0) rack (>= 1.0, < 4) @@ -732,7 +732,7 @@ GEM unf_ext unf_ext (0.0.9.1) unicode-display_width (2.5.0) - uri (0.13.0) + uri (1.0.3) uuid (2.3.9) macaddr (~> 1.0) valid (1.2.0) @@ -832,7 +832,7 @@ DEPENDENCIES omniauth-tumblr (= 1.2) omniauth-twitter (= 1.4.0) omniauth-wordpress (= 0.2.2) - open_graph_reader (= 0.8.0) + open_graph_reader (= 0.9.1) openid_connect (= 2.3.0) pg (= 1.5.6) pronto (= 0.11.2) diff --git a/config/initializers/open_graph_reader.rb b/config/initializers/open_graph_reader.rb index 27da867b2..2d7e8f104 100644 --- a/config/initializers/open_graph_reader.rb +++ b/config/initializers/open_graph_reader.rb @@ -1,11 +1,12 @@ # frozen_string_literal: true OpenGraphReader.configure do |config| - config.synthesize_title = true - config.synthesize_url = true - config.synthesize_full_url = true - config.synthesize_image_url = true - config.guess_datetime_format = true + config.synthesize_title = true + config.synthesize_url = true + config.synthesize_full_url = true + config.synthesize_full_image_url = true + config.synthesize_image_content = true + config.guess_datetime_format = true end og_video_urls = [] diff --git a/features/support/webmock.rb b/features/support/webmock.rb index e584b31a5..92678f759 100644 --- a/features/support/webmock.rb +++ b/features/support/webmock.rb @@ -7,7 +7,7 @@ Before do stub_request(:head, /.+/).with( headers: { "Accept" => "text/html", - "User-Agent" => "OpenGraphReader/0.8.0 (+https://github.com/jhass/open_graph_reader)" + "User-Agent" => "OpenGraphReader/0.9.1 (+https://github.com/jhass/open_graph_reader)" } ).to_return(status: 200, body: "", headers: {"Content-Type" => "text/plain"}) end diff --git a/spec/models/open_graph_cache_spec.rb b/spec/models/open_graph_cache_spec.rb index 558e402d9..a64c759b4 100644 --- a/spec/models/open_graph_cache_spec.rb +++ b/spec/models/open_graph_cache_spec.rb @@ -63,7 +63,7 @@ describe OpenGraphCache, type: :model do stub_request(:head, "http:///wetter.com") .with(headers: { "Accept" => "text/html", - "User-Agent" => "OpenGraphReader/0.8.0 (+https://github.com/jhass/open_graph_reader)" + "User-Agent" => "OpenGraphReader/0.9.1 (+https://github.com/jhass/open_graph_reader)" }) .to_return(status: 200, body: "", headers: {"Set-Cookie" => "Dabgroup=A;path=/;Expires=Thu, 23 May 2019 16:12:01 GMT;httpOnly"})