Allow bad end font tag when removing formatting

This commit is contained in:
niksedk 2021-08-16 20:22:01 +02:00
parent c4ee7759f8
commit 119690ec51
2 changed files with 19 additions and 1 deletions

View File

@ -472,7 +472,9 @@ namespace Nikse.SubtitleEdit.Core.Common
}
}
if ((next == 'f' || next == 'F') && s.Substring(i).StartsWith("<font", StringComparison.OrdinalIgnoreCase) || // <font
next == '/' && (nextNext == 'f' || nextNext == 'F') && s.Substring(i).StartsWith("</font>", StringComparison.OrdinalIgnoreCase)) // </font>
next == '/' && (nextNext == 'f' || nextNext == 'F') && s.Substring(i).StartsWith("</font>", StringComparison.OrdinalIgnoreCase) || // </font>
next == ' ' && nextNext == '/' && s.Substring(i).StartsWith("< /font>", StringComparison.OrdinalIgnoreCase) || // < /font>
next == '/' && nextNext == ' ' && s.Substring(i).StartsWith("</ font>", StringComparison.OrdinalIgnoreCase)) // </ font>
{
inside = true;
continue;

View File

@ -30609,6 +30609,22 @@ namespace Nikse.SubtitleEdit.Forms
{
s = s.Remove(endIndex, 7);
}
else
{
endIndex = s.IndexOf("< /font>", match.Index - 5, StringComparison.OrdinalIgnoreCase);
if (endIndex >= 0)
{
s = s.Remove(endIndex, 7);
}
else
{
endIndex = s.IndexOf("</ font>", match.Index - 5, StringComparison.OrdinalIgnoreCase);
if (endIndex >= 0)
{
s = s.Remove(endIndex, 7);
}
}
}
}
else if (s.Length > match.Index + 1 && s[match.Index + 1] == '>')
{