fix: skip unreadable Office files during project review

This commit is contained in:
muena
2026-10-09 09:09:27 +02:00
parent 818f9ed814
commit 925890a156
3 changed files with 93 additions and 18 deletions

View File

@@ -99,6 +99,24 @@ describe("Velum-Projektstände", () => {
expect(await project.loadProjectEntityTypes(other, support)).toBeNull();
});
it("überspringt temporäre und falsch benannte Office-Dateien vor der API-Analyse", async () => {
const root = await fs.mkdtemp(join(tmpdir(), "velum-office-scan-test-"));
roots.push(root);
await fs.writeFile(join(root, "Notiz.txt"), "Nur ein künstlicher Testtext");
await fs.writeFile(join(root, "Bericht.xlsx"), "Kein Excel-Archiv");
await fs.writeFile(join(root, "~$Entwurf.xlsx"), "Sperrdatei");
await fs.writeFile(join(root, "._Tabelle.xlsx"), "AppleDouble");
await fs.writeFile(join(root, "Gültig.xlsx"), Buffer.from([0x50, 0x4b, 0x03, 0x04, 0x00]));
const scan = await project.scanProjectFiles(root);
expect(scan.files.map((file) => file.relPath)).toEqual(["Gültig.xlsx", "Notiz.txt"]);
expect(scan.skipped).toEqual(expect.arrayContaining([
{ path: "Bericht.xlsx", reason: expect.stringContaining("Office-ZIP-Archiv") },
{ path: "~$Entwurf.xlsx", reason: "Temporäre Office-/macOS-Datei" },
{ path: "._Tabelle.xlsx", reason: "Temporäre Office-/macOS-Datei" },
]));
});
it("stellt aktuelle In-Place-Dateien aus dem Projektordner und frühere Stände aus dem Snapshot bereit", async () => {
const root = await fs.mkdtemp(join(tmpdir(), "velum-current-source-test-"));
roots.push(root);