Truncate long file names in MediaDownloader

Fixes #344
This commit is contained in:
Alexey Golub
2020-07-29 20:58:38 +03:00
parent 47a1518cd9
commit 1fe4ecb3af
2 changed files with 6 additions and 1 deletions

View File

@@ -4,6 +4,11 @@ namespace DiscordChatExporter.Domain.Internal.Extensions
{
internal static class StringExtensions
{
public static string Truncate(this string str, int charCount) =>
str.Length > charCount
? str.Substring(0, charCount)
: str;
public static StringBuilder AppendIfNotEmpty(this StringBuilder builder, char value) =>
builder.Length > 0
? builder.Append(value)