v0.21 Add support for Gossamer inlined external image URLs in Discourse

This commit is contained in:
David Sainty 2024-06-29 00:14:23 +10:00
parent 0bba1c4638
commit 171159cba2

View File

@ -1,5 +1,5 @@
# gossamer threads migration-import code # gossamer threads migration-import code
# v0.20 # v0.21
require 'mysql2' require 'mysql2'
require 'open-uri' require 'open-uri'
@ -687,6 +687,9 @@ class GossamerForumsImporter < ImportScripts::Base
# Remove unsupported tags # Remove unsupported tags
sanitized_message.gsub!(/\[.*?\]/, '') sanitized_message.gsub!(/\[.*?\]/, '')
# Convert inline image syntax from `!(url)` to `![image](url)`
sanitized_message.gsub!(/!\((http[s]?:\/\/[^\)]+)\)/, '![image](\1)')
sanitized_message sanitized_message
end end