From a6df981caecbbc8e18de686a006193031425ee4b Mon Sep 17 00:00:00 2001 From: saint Date: Sat, 7 Dec 2024 17:08:53 +1100 Subject: [PATCH] Tackle the root issue with Discourse not playing ball with post min entropy 0 / post unclear issue --- goss-restorethread.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/goss-restorethread.rb b/goss-restorethread.rb index de0b154..f874a67 100644 --- a/goss-restorethread.rb +++ b/goss-restorethread.rb @@ -1049,8 +1049,13 @@ class GossamerForumsImporter < ImportScripts::Base # sanitized_message.sub!(/\n?\[signature\]\n?\z/, '') # sanitized_message.gsub(/\n?\[signature\]\n?/, '') sanitized_message.gsub!(/[\r\n]*\[signature\][\r\n]*/, '') + + # Remove [inline] style inlining. sanitized_message.gsub!(/[\r\n]*\[inline.*\][\r\n]*/, '') + # Remove ![http://data:image/, etc. as this is not supported. + sanitized_message.gsub!(/!\[data:image\/[^\]]+\]\([^)]+\)/, '') + # Ensure minimum length if sanitized_message.strip.empty? || sanitized_message.length < 5 sanitized_message = "Empty post contents."