mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
Enhance file download handling and format validation in htmlDocumentConverter
This commit is contained in:
@@ -89,7 +89,13 @@ const module_exports = {
|
||||
* @param {string} [options.outputName] - Optional output filename (without extension)
|
||||
* @param {boolean} [options.showDialog] - Show save dialog (default: false in module mode, true in CLI mode)
|
||||
*/
|
||||
async convert({ inputPath, format = 'pdf', outputName, showDialog = false }) {
|
||||
async convert({ inputPath, format = 'pdf', outputName, showDialog = false }) {
|
||||
|
||||
format = format.toLowerCase().replace('.', ''); // <-- FIX
|
||||
|
||||
if (!['pdf', 'docx', 'html', 'txt'].includes(format)) {
|
||||
throw new Error(`Unsupported format: ${format}`);
|
||||
}
|
||||
if (!fs.existsSync(inputPath)) {
|
||||
throw new Error(`Input file not found: ${inputPath}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user