diff --git a/src/converters/calibre.ts b/src/converters/calibre.ts index af06eb4f..952f79d8 100644 --- a/src/converters/calibre.ts +++ b/src/converters/calibre.ts @@ -27,7 +27,6 @@ export const properties = { "pml", "rb", "rtf", - "recipe", "snb", "tcr", "txt", @@ -67,6 +66,18 @@ export async function convert( options?: unknown, execFile: ExecFileFn = execFileOriginal, // to make it mockable ): Promise { + const normalizedFileType = fileType.toLowerCase(); + const fileExt = (filePath.split(".").pop() ?? "").toLowerCase(); + + if ( + normalizedFileType === "recipe" || + normalizedFileType === "downloaded_recipe" || + fileExt === "recipe" || + fileExt === "downloaded_recipe" + ) { + throw new Error("Recipe files are not supported"); + } + return new Promise((resolve, reject) => { execFile("ebook-convert", [filePath, targetPath], (error, stdout, stderr) => { if (error) {