diff --git a/app/server/appsmith-git/src/main/java/com/appsmith/git/helpers/FileUtilsImpl.java b/app/server/appsmith-git/src/main/java/com/appsmith/git/helpers/FileUtilsImpl.java index 81503ebba4..2bfb863f9d 100644 --- a/app/server/appsmith-git/src/main/java/com/appsmith/git/helpers/FileUtilsImpl.java +++ b/app/server/appsmith-git/src/main/java/com/appsmith/git/helpers/FileUtilsImpl.java @@ -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); diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitFileUtils.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitFileUtils.java index e787f4d935..9df3712a49 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitFileUtils.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/GitFileUtils.java @@ -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")) {