Skip to content

Commit c9e34e4

Browse files
committed
more robust input processing
1 parent 929f7d0 commit c9e34e4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/input.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ export function processInput(originalInput: Partial<Input>): Input {
1515

1616
// actors can be a string or an array of strings
1717
if (input.actors && typeof input.actors === 'string') {
18-
input.actors = input.actors.split(',').map((format: string) => format.trim()) as string[];
18+
/**
19+
* Filter out empty strings to prevent invalid Actor API error.
20+
*/
21+
input.actors = input.actors.split(',').map((format: string) => format.trim()).filter((actor) => actor !== '') as string[];
1922
}
2023
/**
2124
* Replace empty string with empty array to prevent invalid Actor API error.
@@ -37,7 +40,10 @@ export function processInput(originalInput: Partial<Input>): Input {
3740
}
3841

3942
if (input.tools && typeof input.tools === 'string') {
40-
input.tools = input.tools.split(',').map((tool: string) => tool.trim()) as ToolCategory[];
43+
/**
44+
* Filter out empty strings just in case.
45+
*/
46+
input.tools = input.tools.split(',').map((tool: string) => tool.trim()).filter((tool) => tool !== '') as ToolCategory[];
4147
}
4248
return input;
4349
}

0 commit comments

Comments
 (0)