diff --git a/lib/api-functions.ts b/lib/api-functions.ts index d9929cc..9c26a0a 100644 --- a/lib/api-functions.ts +++ b/lib/api-functions.ts @@ -226,11 +226,14 @@ function sanitizeTask(task): void { break; case "download": - if (typeof task.fileType !== "string" || !task.fileType.length) - throw new Error("Missing 'fileType' property"); + // genieacs-gui sends file ID instead of fileName and fileType + if (!task.file) { + if (typeof task.fileType !== "string" || !task.fileType.length) + throw new Error("Missing 'fileType' property"); - if (typeof task.fileName !== "string" || !task.fileName.length) - throw new Error("Missing 'fileName' property"); + if (typeof task.fileName !== "string" || !task.fileName.length) + throw new Error("Missing 'fileName' property"); + } if ( task.targetFileName != null && diff --git a/lib/cwmp.ts b/lib/cwmp.ts index e9d76ff..2a20a24 100644 --- a/lib/cwmp.ts +++ b/lib/cwmp.ts @@ -670,7 +670,7 @@ async function nextRpc(sessionContext: SessionContext): Promise { break; case "download": session.addProvisions(sessionContext, `task_${task._id}`, [ - ["download", task.fileType, task.fileName, task.targetFileName] + ["download", task.fileType, task.fileName, task.targetFileName || ""] ]); break; case "addObject":