mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-06-05 17:14:23 -04:00
parent
ac7ebd6f91
commit
fcca052165
2 changed files with 10 additions and 3 deletions
|
@ -71,4 +71,4 @@ namespace DiscordChatExporter.Core.Discord.Data
|
||||||
return new User(id, isBot, discriminator, name, avatarUrl);
|
return new User(id, isBot, discriminator, name, avatarUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -238,8 +238,8 @@ namespace DiscordChatExporter.Core.Markdown.Parsing
|
||||||
new Regex("<t:(\\d+)(?::\\w)?>", DefaultRegexOptions),
|
new Regex("<t:(\\d+)(?::\\w)?>", DefaultRegexOptions),
|
||||||
(_, m) =>
|
(_, m) =>
|
||||||
{
|
{
|
||||||
// We don't care about the 'R' parameter because we're not going to
|
// TODO: support formatting parameters
|
||||||
// show relative timestamps in an export anyway.
|
// See: https://github.com/Tyrrrz/DiscordChatExporter/issues/662
|
||||||
|
|
||||||
if (!long.TryParse(m.Groups[1].Value, NumberStyles.Integer, CultureInfo.InvariantCulture,
|
if (!long.TryParse(m.Groups[1].Value, NumberStyles.Integer, CultureInfo.InvariantCulture,
|
||||||
out var offset))
|
out var offset))
|
||||||
|
@ -247,6 +247,13 @@ namespace DiscordChatExporter.Core.Markdown.Parsing
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bound check
|
||||||
|
// https://github.com/Tyrrrz/DiscordChatExporter/issues/681
|
||||||
|
if (offset < TimeSpan.MinValue.TotalSeconds || offset > TimeSpan.MaxValue.TotalSeconds)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return new UnixTimestampNode(DateTimeOffset.UnixEpoch + TimeSpan.FromSeconds(offset));
|
return new UnixTimestampNode(DateTimeOffset.UnixEpoch + TimeSpan.FromSeconds(offset));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue