diff --git a/Directory.Packages.props b/Directory.Packages.props index a3a98c65..abcce00f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -34,7 +34,7 @@ - + diff --git a/DiscordChatExporter.Core/Exporting/ExportAssetDownloader.cs b/DiscordChatExporter.Core/Exporting/ExportAssetDownloader.cs index 030e0ac5..eb44d4a9 100644 --- a/DiscordChatExporter.Core/Exporting/ExportAssetDownloader.cs +++ b/DiscordChatExporter.Core/Exporting/ExportAssetDownloader.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Security.Cryptography; using System.Text; -using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using System.Web; @@ -96,7 +95,7 @@ internal partial class ExportAssetDownloader private static string GetFileNameFromUrl(string url, string urlHash) { // Try to extract the file name from URL - var fileName = Regex.Match(url, @".+/([^?]*)").Groups[1].Value; + var fileName = new Uri(url, UriKind.RelativeOrAbsolute).TryGetFileName(); // If it's not there, just use the URL hash as the file name if (string.IsNullOrWhiteSpace(fileName))