Skip to content

Commit ce9487a

Browse files
waleedlatif1claude
andcommitted
fix(jira): handle JSON-stringified ADF in toAdf() for variable resolution
The executor's formatValueForBlock() JSON.stringify's object values when resolving <Block.output> references. This means an ADF object from an upstream Agent block arrives at the route as a JSON string. toAdf() now detects JSON strings containing valid ADF documents or nodes and parses them back, ensuring rich formatting is preserved through the pipeline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 184f349 commit ce9487a

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

apps/sim/tools/jira/utils.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ export function toAdf(value: string | Record<string, unknown>): Record<string, u
1818
return { type: 'doc', version: 1, content: [value] }
1919
}
2020
}
21+
if (typeof value === 'string') {
22+
try {
23+
const parsed = JSON.parse(value)
24+
if (typeof parsed === 'object' && parsed !== null && parsed.type === 'doc') {
25+
return parsed
26+
}
27+
if (typeof parsed === 'object' && parsed !== null && parsed.type && Array.isArray(parsed.content)) {
28+
return { type: 'doc', version: 1, content: [parsed] }
29+
}
30+
} catch {
31+
// Not JSON — treat as plain text below
32+
}
33+
}
2134
return {
2235
type: 'doc',
2336
version: 1,

0 commit comments

Comments
 (0)