Merge pull request #8345 from Budibase/fix/hbs-non-string-types

Ensure non string types are ignored when searching for HBS blocks
This commit is contained in:
Andrew Kingston 2022-10-21 10:48:27 +01:00 committed by GitHub
commit 84e9f141a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -323,6 +323,9 @@ module.exports.doesContainStrings = (template, strings) => {
* @return {string[]} The found HBS blocks. * @return {string[]} The found HBS blocks.
*/ */
module.exports.findHBSBlocks = string => { module.exports.findHBSBlocks = string => {
if (!string || typeof string !== "string") {
return []
}
let regexp = new RegExp(FIND_ANY_HBS_REGEX) let regexp = new RegExp(FIND_ANY_HBS_REGEX)
let matches = string.match(regexp) let matches = string.match(regexp)
if (matches == null) { if (matches == null) {