In case of no mustache bindings are found in dynamic path list, throw invalid dynamic binding reference error. (#3394)

This commit is contained in:
Trisha Anand 2021-03-04 15:35:46 +05:30 committed by GitHub
parent 39e4990a7f
commit 20ed017a58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -346,6 +346,13 @@ public class LayoutActionServiceImpl implements LayoutActionService {
// Only extract mustache keys from leaf nodes
if (parent != null && isLeafNode) {
Set<String> mustacheKeysFromFields = MustacheHelper.extractMustacheKeysFromFields(parent);
// We found the path. But if the path does not have any mustache bindings, throw the error
if (mustacheKeysFromFields.isEmpty()) {
throw new AppsmithException(AppsmithError.INVALID_DYNAMIC_BINDING_REFERENCE, widgetType,
widgetName, widgetId, fieldPath, pageId, layoutId);
}
dynamicBindings.addAll(mustacheKeysFromFields);
}
}