Fix download task object validation
This commit is contained in:
1 parent
ab27ebfaef
commit
765f0be7bc
2 files changed
+4
-1
No files matched your search
@@ -226,11 +226,14 @@ function sanitizeTask(task): void {
|
||||
break;
|
||||
|
||||
case "download":
|
||||
// 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 (
|
||||
task.targetFileName != null &&
|
||||
|
||||
+1
-1
@@ -670,7 +670,7 @@ async function nextRpc(sessionContext: SessionContext): Promise<void> {
|
||||
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":
|
||||
|
||||
Reference in new issue
Block a user