diff --git a/api/src/processing/request.js b/api/src/processing/request.js index 2e0cce52..901e8e96 100644 --- a/api/src/processing/request.js +++ b/api/src/processing/request.js @@ -70,6 +70,19 @@ export function createResponse(responseType, responseData) { isHLS: responseData?.isHLS, } + + if (!response.audio.format) { + if (response.type === "audio") { + // audio response without a format is invalid + return internalError(); + } + delete response.audio; + } + + if (!response.output.type || !response.output.filename) { + // response without a type or filename is invalid + return internalError(); + } break; case "picker": diff --git a/web/src/lib/types/api.ts b/web/src/lib/types/api.ts index 5e6e8a84..22e4a672 100644 --- a/web/src/lib/types/api.ts +++ b/web/src/lib/types/api.ts @@ -51,9 +51,9 @@ export type CobaltLocalProcessingResponse = { service: string, tunnel: string[], - output?: { - type?: string, // mimetype - filename?: string, + output: { + type: string, // mimetype + filename: string, metadata?: { album?: string, copyright?: string,