diff --git a/lib/components/playbutton_card.dart b/lib/components/playbutton_card.dart index d540d31e..ae9050d8 100644 --- a/lib/components/playbutton_card.dart +++ b/lib/components/playbutton_card.dart @@ -58,7 +58,7 @@ class PlaybuttonCard extends HookWidget { others: 15, ); - var unescapeHtml = description?.unescapeHtml(); + final unescapeHtml = description?.unescapeHtml().cleanHtml(); return Container( constraints: BoxConstraints(maxWidth: size), margin: margin, diff --git a/lib/components/tracks_view/sections/header/flexible_header.dart b/lib/components/tracks_view/sections/header/flexible_header.dart index 6845cc3e..508d289c 100644 --- a/lib/components/tracks_view/sections/header/flexible_header.dart +++ b/lib/components/tracks_view/sections/header/flexible_header.dart @@ -128,7 +128,9 @@ class TrackViewFlexHeader extends HookConsumerWidget { if (props.description != null && props.description!.isNotEmpty) Text( - props.description!.unescapeHtml(), + props.description! + .unescapeHtml() + .cleanHtml(), style: defaultTextStyle.style.copyWith( color: palette.bodyTextColor, diff --git a/lib/extensions/string.dart b/lib/extensions/string.dart index d3706f3f..94123fe3 100644 --- a/lib/extensions/string.dart +++ b/lib/extensions/string.dart @@ -1,12 +1,15 @@ import 'package:html_unescape/html_unescape.dart'; +import 'package:html/parser.dart'; final htmlEscape = HtmlUnescape(); extension UnescapeHtml on String { + String cleanHtml() => parse("
$this
").documentElement!.text; String unescapeHtml() => htmlEscape.convert(this); } extension NullableUnescapeHtml on String? { + String? cleanHtml() => this?.cleanHtml(); String? unescapeHtml() => this?.unescapeHtml(); }