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.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@@ -40,6 +41,8 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Utilities
/// <param name="description">String to format.</param> /// <param name="description">String to format.</param>
/// <returns>A string with \n replaced by br tags.</returns> /// <returns>A string with \n replaced by br tags.</returns>
public static string FormatDescription(string description) public static string FormatDescription(string description)
{
try
{ {
var maxLength = 500; var maxLength = 500;
if (Plugin.Instance != null) if (Plugin.Instance != null)
@@ -50,11 +53,17 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Utilities
if (description.Length > maxLength) if (description.Length > maxLength)
{ {
description = description.Substring(0, maxLength); description = description.Substring(0, maxLength);
description = description.Replace("\n", "<br>", System.StringComparison.CurrentCulture);
} }
description = description.Replace("\n", "<br>", System.StringComparison.CurrentCulture);
return description; return description;
} }
catch (Exception)
{
return "Error getting description";
}
}
/// <summary> /// <summary>
/// Get video name from file path on the disk. /// Get video name from file path on the disk.