mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-06-24 16:12:44 +00:00
Fix output path detection to correctly identify directories and files (#1556)
This commit is contained in:
@@ -206,10 +206,15 @@ public partial class ExportRequest
|
|||||||
{
|
{
|
||||||
var actualOutputPath = FormatPath(outputPath, guild, channel, after, before);
|
var actualOutputPath = FormatPath(outputPath, guild, channel, after, before);
|
||||||
|
|
||||||
// Output is a directory
|
// Determine whether the output path refers to a directory or a file.
|
||||||
|
// The extension-based heuristic is evaluated on the original, unsubstituted path,
|
||||||
|
// because the value of a template token (e.g. a guild or channel name) may contain
|
||||||
|
// a period that would otherwise be mistaken for a file extension, incorrectly causing
|
||||||
|
// a directory path to be treated as a file.
|
||||||
|
// https://github.com/Tyrrrz/DiscordChatExporter/issues/1502
|
||||||
if (
|
if (
|
||||||
Directory.Exists(actualOutputPath)
|
Directory.Exists(actualOutputPath)
|
||||||
|| string.IsNullOrWhiteSpace(Path.GetExtension(actualOutputPath))
|
|| string.IsNullOrWhiteSpace(Path.GetExtension(outputPath))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
var fileName = GetDefaultOutputFileName(guild, channel, format, after, before);
|
var fileName = GetDefaultOutputFileName(guild, channel, format, after, before);
|
||||||
|
|||||||
Reference in New Issue
Block a user