fix: ENOENT download error for archive-only converters (PDFMathTranslate/MinerU)
- Add existsSync checks in download.tsx before file access - Fix normalizeFiletype.ts: md-t/md-i return original format (not tar.gz) - Add outputMode: 'archive' support in main.ts with auto .tar suffix - PDFMathTranslate outputs translated-<lang>.pdf + bilingual-<lang>.pdf (no original) - MinerU outputs complete folder in .tar with logging - Hide preview icon for .tar files in results.tsx - Update Bun version: 1.2.2 -> 1.3.6 - Add Step 19: auto-deploy to remote server after Docker push All 159 tests pass.
This commit is contained in:
parent
1f800c3619
commit
912546aaa7
10 changed files with 190 additions and 63 deletions
|
|
@ -255,7 +255,7 @@ describe("PDFMathTranslate converter - Output structure", () => {
|
|||
}
|
||||
});
|
||||
|
||||
test("should create archive with original.pdf and translated-<lang>.pdf", async () => {
|
||||
test("should create archive with translated-<lang>.pdf and bilingual-<lang>.pdf (no original)", async () => {
|
||||
let tarSourceDir = "";
|
||||
let archiveContents: string[] = [];
|
||||
|
||||
|
|
@ -271,7 +271,9 @@ describe("PDFMathTranslate converter - Output structure", () => {
|
|||
if (!existsSync(outputDir)) {
|
||||
mkdirSync(outputDir, { recursive: true });
|
||||
}
|
||||
// 模擬 pdf2zh 產生 mono(翻譯版)和 dual(對照版)
|
||||
writeFileSync(join(outputDir, "input-mono.pdf"), "%PDF-1.4\n%Translated");
|
||||
writeFileSync(join(outputDir, "input-dual.pdf"), "%PDF-1.4\n%Bilingual");
|
||||
}
|
||||
callback(null, "Translation complete", "");
|
||||
} else if (cmd === "tar") {
|
||||
|
|
@ -291,9 +293,11 @@ describe("PDFMathTranslate converter - Output structure", () => {
|
|||
const targetPath = join(testDir, "output.tar");
|
||||
await convert(testInputFile, "pdf", "pdf-ko", targetPath, undefined, mockExecFile);
|
||||
|
||||
// Verify archive contains expected files
|
||||
expect(archiveContents).toContain("original.pdf");
|
||||
// Verify archive contains expected files (翻譯版 + 對照版,不包含原始檔)
|
||||
expect(archiveContents).toContain("translated-ko.pdf");
|
||||
expect(archiveContents).toContain("bilingual-ko.pdf");
|
||||
// 不應包含原始檔案
|
||||
expect(archiveContents).not.toContain("original.pdf");
|
||||
});
|
||||
|
||||
test("should only use .tar format, not .tar.gz", async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue