mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-05-04 03:23:36 +00:00
Use PowerKit's Uri.TryGetFilaName()
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
|
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
|
||||||
<PackageVersion Include="Onova" Version="2.6.13" />
|
<PackageVersion Include="Onova" Version="2.6.13" />
|
||||||
<PackageVersion Include="Polly" Version="8.6.6" />
|
<PackageVersion Include="Polly" Version="8.6.6" />
|
||||||
<PackageVersion Include="PowerKit" Version="1.1.0" />
|
<PackageVersion Include="PowerKit" Version="1.1.1" />
|
||||||
<PackageVersion Include="RazorBlade" Version="0.11.0" />
|
<PackageVersion Include="RazorBlade" Version="0.11.0" />
|
||||||
<PackageVersion Include="Spectre.Console" Version="0.54.0" />
|
<PackageVersion Include="Spectre.Console" Version="0.54.0" />
|
||||||
<PackageVersion Include="Superpower" Version="3.1.0" />
|
<PackageVersion Include="Superpower" Version="3.1.0" />
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
@@ -96,7 +95,7 @@ internal partial class ExportAssetDownloader
|
|||||||
private static string GetFileNameFromUrl(string url, string urlHash)
|
private static string GetFileNameFromUrl(string url, string urlHash)
|
||||||
{
|
{
|
||||||
// Try to extract the file name from URL
|
// 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 it's not there, just use the URL hash as the file name
|
||||||
if (string.IsNullOrWhiteSpace(fileName))
|
if (string.IsNullOrWhiteSpace(fileName))
|
||||||
|
|||||||
Reference in New Issue
Block a user