Skip to content

Commit 99d0a9b

Browse files
waleedlatif1claude
andcommitted
fix(jira): handle partial ADF nodes and non-ADF objects in toAdf()
Wrap partial ADF nodes (type + content but not doc) in a doc envelope. Fall back to JSON.stringify for non-ADF objects instead of String() which produces [object Object]. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 32769da commit 99d0a9b

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

apps/sim/tools/jira/utils.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,21 @@ const MAX_ATTACHMENT_SIZE = 50 * 1024 * 1024
1010
* it is returned as-is. If it is a plain string, it is wrapped in a single-paragraph ADF doc.
1111
*/
1212
export function toAdf(value: string | Record<string, unknown>): Record<string, unknown> {
13-
if (typeof value === 'object' && value.type === 'doc') {
14-
return value
13+
if (typeof value === 'object') {
14+
if (value.type === 'doc') {
15+
return value
16+
}
17+
if (value.type && Array.isArray(value.content)) {
18+
return { type: 'doc', version: 1, content: [value] }
19+
}
1520
}
1621
return {
1722
type: 'doc',
1823
version: 1,
1924
content: [
2025
{
2126
type: 'paragraph',
22-
content: [{ type: 'text', text: String(value) }],
27+
content: [{ type: 'text', text: typeof value === 'string' ? value : JSON.stringify(value) }],
2328
},
2429
],
2530
}

0 commit comments

Comments
 (0)