mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-24 19:54:22 -04:00
Fix for extremely long file extensions (#812)
This commit is contained in:
parent
7c212ef893
commit
ecb615ecf1
1 changed files with 9 additions and 1 deletions
|
@ -103,7 +103,15 @@ internal partial class MediaDownloader
|
||||||
// Otherwise, use the original file name but inject the hash in the middle
|
// Otherwise, use the original file name but inject the hash in the middle
|
||||||
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName);
|
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName);
|
||||||
var fileExtension = Path.GetExtension(fileName);
|
var fileExtension = Path.GetExtension(fileName);
|
||||||
|
|
||||||
|
// Probably not a file extension, just a dot in a long file name
|
||||||
|
// https://github.com/Tyrrrz/DiscordChatExporter/issues/708
|
||||||
|
if (fileExtension.Length > 41)
|
||||||
|
{
|
||||||
|
fileNameWithoutExtension = fileName;
|
||||||
|
fileExtension = "";
|
||||||
|
}
|
||||||
|
|
||||||
return PathEx.EscapeFileName(fileNameWithoutExtension.Truncate(42) + '-' + urlHash + fileExtension);
|
return PathEx.EscapeFileName(fileNameWithoutExtension.Truncate(42) + '-' + urlHash + fileExtension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue