From 4a34f52d4fc0f50455887a0af8ee25c053ac4d31 Mon Sep 17 00:00:00 2001 From: Genteure Date: Sun, 10 Nov 2024 15:02:26 +0800 Subject: [PATCH] feat(core): add 'unescape' filter to file name templating (#622) --- BililiveRecorder.Core/Templating/FileNameGenerator.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/BililiveRecorder.Core/Templating/FileNameGenerator.cs b/BililiveRecorder.Core/Templating/FileNameGenerator.cs index fff570e..0e6e30f 100644 --- a/BililiveRecorder.Core/Templating/FileNameGenerator.cs +++ b/BililiveRecorder.Core/Templating/FileNameGenerator.cs @@ -93,7 +93,11 @@ namespace BililiveRecorder.Core.Templating templateOptions.MemberAccessStrategy.MemberNameStrategy = MemberNameStrategies.CamelCase; templateOptions.ValueConverters.Add(o => o is JContainer j ? new JContainerValue(j) : null); templateOptions.Filters.AddFilter("format_qn", - static (FluidValue input, FilterArguments arguments, TemplateContext context) => new StringValue(StreamQualityNumber.MapToString((int)input.ToNumberValue()))); + static (FluidValue input, FilterArguments arguments, TemplateContext context) + => new StringValue(StreamQualityNumber.MapToString((int)input.ToNumberValue()))); + templateOptions.Filters.AddFilter("unescape", + static (FluidValue input, FilterArguments arguments, TemplateContext context) + => new StringValue(System.Net.WebUtility.HtmlDecode(input.ToStringValue()))); var context = new TemplateContext(data, templateOptions);