chore: catch errors on FormatDescription
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user