commit 7580318c9d58be5a24b320c0d69a87a319292d2d
parent e80ea65987671aeedc0e493ba42f7c832e96870b
Author: Dan Callaghan <djc@djc.id.au>
Date: Sat, 28 Mar 2026 14:35:09 +1100
adjust regex for fixing old YAML tag URIs to handle SentLoader
Apparently some old sources.yaml files would have a source like this:
- !supmua.org,2006-10-01/Redwood/SentLoader {}
The regex previously added in commit 1aac9d4388 would fail to fix up an
invalid tag URI like this because of the trailing empty map.
Fixes #516.
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/sup.rb b/lib/sup.rb
@@ -142,7 +142,7 @@ module Redwood
File::open(fn) { |f| f.read }
end
## fix up malformed tag URIs created by earlier versions of sup
- raw_contents.gsub!(/!supmua.org,2006-10-01\/(\S*)$/) { |m| "!<tag:supmua.org,2006-10-01/#{$1}>" }
+ raw_contents.gsub!(/!supmua.org,2006-10-01\/(\S+)/) { |m| "!<tag:supmua.org,2006-10-01/#{$1}>" }
if YAML.respond_to?(:unsafe_load) # Ruby 3.1+
YAML::unsafe_load raw_contents
else
diff --git a/test/integration/test_sup-add.rb b/test/integration/test_sup-add.rb
@@ -26,6 +26,8 @@ class TestSupAdd < Minitest::Test
EOS
end
+ ## https://github.com/sup-heliotrope/sup/issues/577
+ ## https://github.com/sup-heliotrope/sup/issues/516
def test_fixes_old_tag_uri_syntax
File.write "#{@path}/sources.yaml", <<EOS
---
@@ -36,6 +38,7 @@ EOS
sync_back: true
id: 1
labels: []
+- !supmua.org,2006-10-01/Redwood/SentLoader {}
EOS
_out, _err = capture_subprocess_io do
assert system({"SUP_BASE" => @path}, "bin/sup-add", "maildir:///other/path")
@@ -58,6 +61,7 @@ EOS
sync_back: true
id: 2
labels: []
+- !<tag:supmua.org,2006-10-01/Redwood/SentLoader> {}
EOS
end