From da4f5ea74ac5ea961d5acea96d4e91e14b8db964 Mon Sep 17 00:00:00 2001
From: tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Date: Mon, 20 Apr 2026 22:22:11 +0300
Subject: [PATCH] Use PowerKit's `Uri.TryGetFilaName()`
---
Directory.Packages.props | 2 +-
DiscordChatExporter.Core/Exporting/ExportAssetDownloader.cs | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
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))