From 353f910894520e230e8ba00dd407158a1901b980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Wed, 27 Oct 2021 10:52:17 +0200 Subject: [PATCH] wip uploads url --- app/models/communication/website.rb | 6 +++++- app/models/communication/website/imported/with_rich_text.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb index eac3c8285..95edecc51 100644 --- a/app/models/communication/website.rb +++ b/app/models/communication/website.rb @@ -37,7 +37,11 @@ class Communication::Website < ApplicationRecord end def domain_url - "https://#{ domain }" + "https://#{domain}" + end + + def uploads_url + "#{domain_url}/wp-content/uploads" end def import! diff --git a/app/models/communication/website/imported/with_rich_text.rb b/app/models/communication/website/imported/with_rich_text.rb index b74264692..a1ac94cda 100644 --- a/app/models/communication/website/imported/with_rich_text.rb +++ b/app/models/communication/website/imported/with_rich_text.rb @@ -5,7 +5,7 @@ module Communication::Website::Imported::WithRichText def rich_text_with_attachments(text) fragment = Nokogiri::HTML.fragment(text) - images = fragment.css("img[src*=\"#{website.website.domain_url}\"]") + images = fragment.css("img[src*=\"#{website.website.uploads_url}\"]") images.each do |image| begin url = image.attr('src') -- GitLab