mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-12-05 06:16:23 +01:00
Make template tag scanners quote-aware (#710)
This commit is contained in:
1 parent
23d369d84e
commit
6fc43a60e2
19 files changed
+747
-39
No files matched your search
@@ -1,8 +1,4 @@
|
||||
/**
|
||||
* Matches a template tag up to the first `]}`, the same way the Lezer grammar and the JSON
|
||||
* linter close a tag. Quoted arguments may contain spaces, so this can't stop at whitespace.
|
||||
*/
|
||||
const TEMPLATE_TAG_REGEX = /\$\{\[[\s\S]*?]}/g;
|
||||
import { replaceTemplateTags } from "./templateTags";
|
||||
|
||||
export function validateHttpHeader(v: string): boolean {
|
||||
if (v === "") {
|
||||
@@ -10,6 +6,6 @@ export function validateHttpHeader(v: string): boolean {
|
||||
}
|
||||
|
||||
// Template strings are not allowed so we replace them with a valid example string
|
||||
const withoutTemplateStrings = v.replace(TEMPLATE_TAG_REGEX, "123");
|
||||
const withoutTemplateStrings = replaceTemplateTags(v, () => "123");
|
||||
return withoutTemplateStrings.match(/^[a-zA-Z0-9-_]+$/) !== null;
|
||||
}
|
||||
Reference in new issue
Block a user