From 7ec26f32dc87ce8c29287354909a189e326e7afc Mon Sep 17 00:00:00 2001 From: Shlee Date: Mon, 10 Aug 2026 18:15:56 +0930 Subject: [PATCH] Fix: make NEWLINE_TAGS_RE regex be case insentitive for both
and
edge case. (#40079) --- app/lib/plain_text_formatter.rb | 2 +- spec/lib/plain_text_formatter_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/lib/plain_text_formatter.rb b/app/lib/plain_text_formatter.rb index e8ff79806f..65ae327a3d 100644 --- a/app/lib/plain_text_formatter.rb +++ b/app/lib/plain_text_formatter.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class PlainTextFormatter - NEWLINE_TAGS_RE = %r{(
|
|

)+} + NEWLINE_TAGS_RE = %r{(
|
|

)+}i attr_reader :text, :local diff --git a/spec/lib/plain_text_formatter_spec.rb b/spec/lib/plain_text_formatter_spec.rb index 4683e15093..172b8d31c2 100644 --- a/spec/lib/plain_text_formatter_spec.rb +++ b/spec/lib/plain_text_formatter_spec.rb @@ -25,8 +25,8 @@ RSpec.describe PlainTextFormatter do end end - context 'when text contains

tags' do - let(:status) { Fabricate.build(:status, account: remote_account, text: '

Lorem

ipsum

') } + context 'when text contains mixed case

tags' do + let(:status) { Fabricate.build(:status, account: remote_account, text: '

Lorem

ipsum

') } it 'inserts a newline' do expect(subject).to eq "Lorem\nipsum"