File tree Expand file tree Collapse file tree
executor/handlers/generic Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1964,8 +1964,8 @@ export const FileV5Block: BlockConfig<FileParserV3Output> = {
19641964 * Explicitly clear unused Content because the executor merges these params
19651965 * over the original inputs. Preserve empty text when no file is selected.
19661966 */
1967- const contentText = typeof params . content === 'string' ? params . content : undefined
1968- const omitContent = Boolean ( fileInput ) && ! contentText
1967+ const omitContent =
1968+ Boolean ( fileInput ) && ( params . content == null || params . content === '' )
19691969 return {
19701970 fileName : params . fileName ,
19711971 folderPath : optionalText ( params . writeFolderRef ) ,
Original file line number Diff line number Diff line change @@ -69,6 +69,21 @@ describe('File Write executor inputs', () => {
6969 ] )
7070 } )
7171
72+ it . each ( [ 0 , false , { text : 'invalid' } , [ 'invalid' ] ] ) (
73+ 'rejects non-string Content %j alongside a file' ,
74+ async ( content ) => {
75+ const result = await executeWrite ( { content, writeFileInput : generatedFile } )
76+
77+ expect ( result . success ) . toBe ( false )
78+ if ( result . success ) throw new Error ( 'Expected malformed Content to fail validation' )
79+ expect ( result . error . issues ) . toEqual (
80+ expect . arrayContaining ( [
81+ expect . objectContaining ( { path : [ 'content' ] , code : 'invalid_type' } ) ,
82+ ] )
83+ )
84+ }
85+ )
86+
7287 it . each ( [ '' , 'text' ] ) ( 'preserves text-only Content %j' , async ( content ) => {
7388 const result = await executeWrite ( { content } )
7489
You can’t perform that action at this time.
0 commit comments