Fix case-insensitive lookup for data package index file

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-01 18:45:09 +00:00
parent a781d9cfa9
commit 2976acc480
3 changed files with 9 additions and 3 deletions

View file

@ -24,7 +24,7 @@ internal partial class TempDir
{ {
var dirPath = System.IO.Path.Combine( var dirPath = System.IO.Path.Combine(
System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
?? Directory.GetCurrentDirectory(), ?? Directory.GetCurrentDirectory(),
"Temp", "Temp",
Guid.NewGuid().ToString() Guid.NewGuid().ToString()
); );

View file

@ -24,7 +24,7 @@ internal partial class TempFile
{ {
var dirPath = System.IO.Path.Combine( var dirPath = System.IO.Path.Combine(
System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
?? Directory.GetCurrentDirectory(), ?? Directory.GetCurrentDirectory(),
"Temp" "Temp"
); );

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,12 @@ 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"
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(