From 171159cba270098db1d85f77542c5e201bfab864 Mon Sep 17 00:00:00 2001 From: saint Date: Sat, 29 Jun 2024 00:14:23 +1000 Subject: [PATCH] v0.21 Add support for Gossamer inlined external image URLs in Discourse --- gossamer_forums.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gossamer_forums.rb b/gossamer_forums.rb index be84983..f0b857f 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1,5 +1,5 @@ # gossamer threads migration-import code -# v0.20 +# v0.21 require 'mysql2' require 'open-uri' @@ -687,6 +687,9 @@ class GossamerForumsImporter < ImportScripts::Base # Remove unsupported tags sanitized_message.gsub!(/\[.*?\]/, '') + # Convert inline image syntax from `!(url)` to `![image](url)` + sanitized_message.gsub!(/!\((http[s]?:\/\/[^\)]+)\)/, '![image](\1)') + sanitized_message end