DEV: improve subfolder inline logic
This follows up on #503a11cc88f with a spec
This commit is contained in:
parent
503a11cc88
commit
93b0ffc85c
|
@ -284,7 +284,10 @@ class InlineUploads
|
|||
|
||||
if cdn_url
|
||||
regexps << /(#{cdn_url}\/uploads\/#{db}#{UPLOAD_REGEXP_PATTERN})/
|
||||
regexps << /(#{cdn_url}#{GlobalSetting.relative_url_root}\/uploads\/#{db}#{UPLOAD_REGEXP_PATTERN})/ unless GlobalSetting.relative_url_root.nil?
|
||||
if GlobalSetting.relative_url_root.present?
|
||||
regexps << /(#{cdn_url}#{GlobalSetting.relative_url_root}\/uploads\/#{db}#{UPLOAD_REGEXP_PATTERN})/
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
if Discourse.store.external?
|
||||
|
|
|
@ -217,13 +217,16 @@ RSpec.describe InlineUploads do
|
|||
end
|
||||
|
||||
it "should correct subfolder images" do
|
||||
|
||||
md = <<~MD
|
||||
<img src="/community#{upload.url}">
|
||||
|
||||
#{Discourse.base_url}#{upload.url}
|
||||
MD
|
||||
|
||||
expect(InlineUploads.process(md)).to eq(<<~MD)
|
||||
![](#{upload.short_url})
|
||||
|
||||
![](#{upload.short_url})
|
||||
MD
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue