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:
Your Name 2026-01-22 00:47:37 +08:00
parent 1f800c3619
commit 912546aaa7
10 changed files with 190 additions and 63 deletions

View file

@ -113,6 +113,7 @@ export async function convert(
// Create .tar archive from the output directory (不使用壓縮)
// 強制使用 .tar 格式,禁止 .tar.gz
const tarPath = getArchiveFileName(targetPath);
console.log(`[MinerU] Target tar path: ${tarPath}`);
// Ensure the parent directory exists
const tarDir = dirname(tarPath);
@ -121,11 +122,21 @@ export async function convert(
}
// Use the actual MinerU output directory for archiving
// MinerU 產生完整資料夾結構,全部封裝進 .tar
const outputToArchive = existsSync(mineruActualOutput)
? mineruActualOutput
: mineruOutputDir;
console.log(`[MinerU] Archiving directory: ${outputToArchive}`);
// 列出要封裝的內容
if (existsSync(outputToArchive)) {
const contents = readdirSync(outputToArchive);
console.log(`[MinerU] Archive contents: ${contents.join(", ")}`);
}
await createTarArchive(outputToArchive, tarPath, execFile);
console.log(`[MinerU] Created archive: ${tarPath}`);
// Clean up the temporary directory
removeDir(mineruOutputDir);