From b0ca3a49a587f7452e08fdb606e5e94951a5891d Mon Sep 17 00:00:00 2001
From: wolffshots <16850875+wolffshots@users.noreply.github.com>
Date: Mon, 4 Aug 2025 18:46:30 +0200
Subject: [PATCH] chore: catch errors on FormatDescription
---
.../Utils/Utils.cs | 27 ++++++++++++-------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/Jellyfin.Plugin.TubeArchivistMetadata/Utils/Utils.cs b/Jellyfin.Plugin.TubeArchivistMetadata/Utils/Utils.cs
index e4a1876..f00a9d2 100644
--- a/Jellyfin.Plugin.TubeArchivistMetadata/Utils/Utils.cs
+++ b/Jellyfin.Plugin.TubeArchivistMetadata/Utils/Utils.cs
@@ -1,3 +1,4 @@
+using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
@@ -41,19 +42,27 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Utilities
/// A string with \n replaced by br tags.
public static string FormatDescription(string description)
{
- var maxLength = 500;
- if (Plugin.Instance != null)
+ try
{
- maxLength = Plugin.Instance.Configuration.MaxDescriptionLength;
- }
+ var maxLength = 500;
+ if (Plugin.Instance != null)
+ {
+ maxLength = Plugin.Instance.Configuration.MaxDescriptionLength;
+ }
+
+ if (description.Length > maxLength)
+ {
+ description = description.Substring(0, maxLength);
+ }
- if (description.Length > maxLength)
- {
- description = description.Substring(0, maxLength);
description = description.Replace("\n", "
", System.StringComparison.CurrentCulture);
- }
- return description;
+ return description;
+ }
+ catch (Exception)
+ {
+ return "Error getting description";
+ }
}
///