mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-08-13 14:03:01 -06:00
Update ExportAssetDownloader.cs
This commit is contained in:
parent
3574d03aac
commit
a60f7cb3ee
|
|
@ -38,8 +38,8 @@ internal partial class ExportAssetDownloader(string workingDirPath, bool reuse)
|
||||||
return _previousPathsByUrl[url] = filePath;
|
return _previousPathsByUrl[url] = filePath;
|
||||||
|
|
||||||
// Check for a file cached by the legacy naming scheme (5-char hash) and rename it
|
// Check for a file cached by the legacy naming scheme (5-char hash) and rename it
|
||||||
// to the new naming scheme to preserve backwards compatibility with existing exports
|
// to the new naming scheme to preserve backwards compatibility with existing exports.
|
||||||
// This will catch both the 5-char lowercase hash and the 5-char uppercase hash variants
|
// This will catch both the 5-char lowercase hash and the 5-char uppercase hash variants.
|
||||||
if (reuse)
|
if (reuse)
|
||||||
{
|
{
|
||||||
var legacyFileNames = GetLegacyFileNamesFromUrl(url);
|
var legacyFileNames = GetLegacyFileNamesFromUrl(url);
|
||||||
|
|
@ -52,7 +52,7 @@ internal partial class ExportAssetDownloader(string workingDirPath, bool reuse)
|
||||||
// earlier existence check and this move operation
|
// earlier existence check and this move operation
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Move(legacyFilePath, filePath, overwrite: true);
|
File.Move(legacyFilePath, filePath, true);
|
||||||
return _previousPathsByUrl[url] = filePath;
|
return _previousPathsByUrl[url] = filePath;
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
|
|
@ -142,7 +142,7 @@ internal partial class ExportAssetDownloader
|
||||||
);
|
);
|
||||||
|
|
||||||
// Legacy naming used a 5-char hash, kept for backwards compatibility with existing exports
|
// Legacy naming used a 5-char hash, kept for backwards compatibility with existing exports
|
||||||
private static string[] GetLegacyFileNamesFromUrl(string url)
|
private static IReadOnlyList<string> GetLegacyFileNamesFromUrl(string url)
|
||||||
{
|
{
|
||||||
var hashData = SHA256.HashData(Encoding.UTF8.GetBytes(NormalizeUrl(url)));
|
var hashData = SHA256.HashData(Encoding.UTF8.GetBytes(NormalizeUrl(url)));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue