mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
fix: playlist displaying descriptions unescaped html #1784
This commit is contained in:
parent
1119c0e47d
commit
57c8f85731
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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("<p>$this</p>").documentElement!.text;
|
||||
String unescapeHtml() => htmlEscape.convert(this);
|
||||
}
|
||||
|
||||
extension NullableUnescapeHtml on String? {
|
||||
String? cleanHtml() => this?.cleanHtml();
|
||||
String? unescapeHtml() => this?.unescapeHtml();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user