chore: catch errors on FormatDescription

This commit is contained in:
wolffshots
2025-08-04 18:46:30 +02:00
parent 4358072001
commit b0ca3a49a5
@@ -1,3 +1,4 @@
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
@@ -40,6 +41,8 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Utilities
/// <param name="description">String to format.</param>
/// <returns>A string with \n replaced by br tags.</returns>
public static string FormatDescription(string description)
{
try
{
var maxLength = 500;
if (Plugin.Instance != null)
@@ -50,11 +53,17 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Utilities
if (description.Length > maxLength)
{
description = description.Substring(0, maxLength);
description = description.Replace("\n", "<br>", System.StringComparison.CurrentCulture);
}
description = description.Replace("\n", "<br>", System.StringComparison.CurrentCulture);
return description;
}
catch (Exception)
{
return "Error getting description";
}
}
/// <summary>
/// Get video name from file path on the disk.