Fix download task object validation
This commit is contained in:
1 parent
ab27ebfaef
commit
765f0be7bc
2 files changed
+8
-5
No files matched your search
@@ -226,11 +226,14 @@ function sanitizeTask(task): void {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "download":
|
case "download":
|
||||||
if (typeof task.fileType !== "string" || !task.fileType.length)
|
// genieacs-gui sends file ID instead of fileName and fileType
|
||||||
throw new Error("Missing 'fileType' property");
|
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)
|
if (typeof task.fileName !== "string" || !task.fileName.length)
|
||||||
throw new Error("Missing 'fileName' property");
|
throw new Error("Missing 'fileName' property");
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
task.targetFileName != null &&
|
task.targetFileName != null &&
|
||||||
|
|||||||
+1
-1
@@ -670,7 +670,7 @@ async function nextRpc(sessionContext: SessionContext): Promise<void> {
|
|||||||
break;
|
break;
|
||||||
case "download":
|
case "download":
|
||||||
session.addProvisions(sessionContext, `task_${task._id}`, [
|
session.addProvisions(sessionContext, `task_${task._id}`, [
|
||||||
["download", task.fileType, task.fileName, task.targetFileName]
|
["download", task.fileType, task.fileName, task.targetFileName || ""]
|
||||||
]);
|
]);
|
||||||
break;
|
break;
|
||||||
case "addObject":
|
case "addObject":
|
||||||
|
|||||||
Reference in new issue
Block a user