Fix case-insensitive lookup for data package index file (#1460)

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
Copilot
2026-01-01 21:19:59 +02:00
committed by GitHub
parent 3d353bc1e6
commit 33a975b907
2 changed files with 9 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO.Compression; using System.IO.Compression;
using System.Linq;
using System.Text.Json; using System.Text.Json;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -42,7 +43,13 @@ public partial class DataDump
{ {
using var archive = ZipFile.OpenRead(zipFilePath); using var archive = ZipFile.OpenRead(zipFilePath);
var entry = archive.GetEntry("messages/index.json"); // Try to find the index file with case-insensitive search
// Discord changed the structure from "messages/index.json" to "Messages/index.json"
// https://github.com/Tyrrrz/DiscordChatExporter/issues/1458
var entry = archive.Entries.FirstOrDefault(e =>
e.FullName.Equals("messages/index.json", StringComparison.OrdinalIgnoreCase)
);
if (entry is null) if (entry is null)
{ {
throw new InvalidOperationException( throw new InvalidOperationException(