From 9daed05ad0b6341ffc13f050b9b4b746ae92651d Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 13 Jun 2019 13:53:43 +0800 Subject: [PATCH] Fix the build. --- app/jobs/regular/pull_hotlinked_images.rb | 2 +- app/services/inline_uploads.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/jobs/regular/pull_hotlinked_images.rb b/app/jobs/regular/pull_hotlinked_images.rb index fd5e4b7bf7f..de8bc07cbae 100644 --- a/app/jobs/regular/pull_hotlinked_images.rb +++ b/app/jobs/regular/pull_hotlinked_images.rb @@ -105,7 +105,7 @@ module Jobs InlineUploads.match_img(raw, external_src: true, &replace_raw) # BBCode tag - [img]http://...[/img] - InlineUploads.match_bbcode_img(raw, &replace_raw) + InlineUploads.match_bbcode_img(raw, external_src: true, &replace_raw) # Markdown linked image - [![alt](http://...)](http://...) # Markdown inline - ![alt](http://...) diff --git a/app/services/inline_uploads.rb b/app/services/inline_uploads.rb index 60713c5739c..7d80fb8e84f 100644 --- a/app/services/inline_uploads.rb +++ b/app/services/inline_uploads.rb @@ -164,9 +164,9 @@ class InlineUploads end end - def self.match_bbcode_img(markdown) + def self.match_bbcode_img(markdown, external_src: false) markdown.scan(/(\[img\]\s?(.+)\s?\[\/img\])/) do |match| - if matched_uploads(match[1]).present? && block_given? + if (matched_uploads(match[1]).present? && block_given?) || external_src yield(match[0], match[1], +"![](#{PLACEHOLDER})", $~.offset(0)[0]) end end