DEV: Fix edge case for `InlineUploads`.

approved
#1

DEV: Fix edge case for InlineUploads.

diff --git a/app/services/inline_uploads.rb b/app/services/inline_uploads.rb
index d7f36a0..0c27029 100644
--- a/app/services/inline_uploads.rb
+++ b/app/services/inline_uploads.rb
@@ -100,7 +100,7 @@ class InlineUploads
         end
       end
 
-      markdown.scan(/((\n|\s)+)#{regexp}/) do |match|
+      markdown.scan(/(([\n\s\)\]\<])+)#{regexp}/) do |match|
         if matched_uploads(match[2]).present?
           next if indexes.include?($~.offset(3)[0])
 
diff --git a/spec/services/inline_uploads_spec.rb b/spec/services/inline_uploads_spec.rb
index fc1ca63..0633714 100644
--- a/spec/services/inline_uploads_spec.rb
+++ b/spec/services/inline_uploads_spec.rb
@@ -234,6 +234,20 @@ RSpec.describe InlineUploads do
         MD
       end
 
+      it "should correct image URLs that follows an image md" do
+        md = <<~MD
+        ![image|690x290](#{upload.short_url})#{Discourse.base_url}#{upload2.url}
+
+        <#{Discourse.base_url}#{upload2.url}>
+        MD
+
+        expect(InlineUploads.process(md)).to eq(<<~MD)
+        ![image|690x290](#{upload.short_url})#{Discourse.base_url}#{upload2.short_path}
+
+        <#{Discourse.base_url}#{upload2.short_path}>
+        MD
+      end
+
       it "should correct image URLs to the short version" do
         md = <<~MD
         ![image|690x290](#{upload.short_url})

GitHub sha: 5d16d10a

1 Like
Approved #2