mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-14 07:43:31 -07:00
Fix case-insensitive lookup for data package index file
Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This commit is contained in:
parent
a781d9cfa9
commit
2976acc480
|
|
@ -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()
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue