fix: Add null check before updating the body in actions (#21781)
## Description > When an app which is connected to git which contains empty queries, is imported shows uncommitted changes on opening git sync modal. This PR fixes the issue. Fixes #21742 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
This commit is contained in:
parent
c0278c0897
commit
439ceb5406
|
|
@ -697,7 +697,11 @@ public class FileUtilsImpl implements FileInterface {
|
|||
if (directory.isDirectory()) {
|
||||
for (File dirFile : Objects.requireNonNull(directory.listFiles())) {
|
||||
String resourceName = dirFile.getName();
|
||||
String body = readFileAsString(directoryPath.resolve(resourceName).resolve( resourceName + CommonConstants.TEXT_FILE_EXTENSION));
|
||||
String body = "";
|
||||
Path queryPath = directoryPath.resolve(resourceName).resolve( resourceName + CommonConstants.TEXT_FILE_EXTENSION);
|
||||
if (queryPath.toFile().exists()) {
|
||||
body = readFileAsString(queryPath);
|
||||
}
|
||||
Object file = readFile(directoryPath.resolve(resourceName).resolve( CommonConstants.METADATA + CommonConstants.JSON_EXTENSION), gson);
|
||||
actionCollectionBodyMap.put(resourceName + keySuffix, body);
|
||||
resource.put(resourceName + keySuffix, file);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import com.google.gson.Gson;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.PredicateUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -419,7 +420,7 @@ public class GitFileUtils {
|
|||
// With the file version v4 we have split the actions and metadata separately into two files
|
||||
// So we need to set the body to the unpublished action
|
||||
String keyName = newAction.getUnpublishedAction().getName() + newAction.getUnpublishedAction().getPageId();
|
||||
if (actionBody != null && (actionBody.containsKey(keyName))) {
|
||||
if (actionBody != null && (actionBody.containsKey(keyName)) && !StringUtils.isEmpty(actionBody.get(keyName))) {
|
||||
// For REMOTE plugin like Twilio the user actions are stored in key value pairs and hence they need to be
|
||||
// deserialized separately unlike the body which is stored as string in the db.
|
||||
if (newAction.getPluginType().toString().equals("REMOTE")) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user