mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 00:02:03 +00:00
handle backquotes in template
This commit is contained in:
@@ -60,7 +60,11 @@
|
||||
}
|
||||
|
||||
if (isCodeInjection(rawValue)) {
|
||||
arg.expr = getDefaultExpr(argName, previousModuleId, `\`${rawValue}\``)
|
||||
arg.expr = getDefaultExpr(
|
||||
argName,
|
||||
previousModuleId,
|
||||
`\`${rawValue.toString().replaceAll('`', '\\`')}\``
|
||||
)
|
||||
arg.type = 'javascript'
|
||||
propertyType = 'static'
|
||||
} else {
|
||||
@@ -161,7 +165,7 @@
|
||||
argName,
|
||||
previousModuleId,
|
||||
staticTemplate
|
||||
? `\`${arg?.value ?? ''}\``
|
||||
? `\`${arg?.value.toString().replaceAll('`', '\\`') ?? ''}\``
|
||||
: arg.value
|
||||
? JSON.stringify(arg?.value, null, 4)
|
||||
: ''
|
||||
|
||||
@@ -162,7 +162,7 @@ export function codeToStaticTemplate(code?: string): string | undefined {
|
||||
if (lines.length == 1) {
|
||||
const line = lines[0].trim()
|
||||
if (line[0] == '`' && line.charAt(line.length - 1) == '`') {
|
||||
return line.slice(1, line.length - 1)
|
||||
return line.slice(1, line.length - 1).replaceAll('\\`', '`')
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
|
||||
Reference in New Issue
Block a user