fix: Git import fails when pages directory contains a file (#27467)
## Description It fixes the Git import failure bug when there's a file in the pages directory. #### PR fixes following issue(s) Fixes #27466
This commit is contained in:
parent
0c8ed66d86
commit
4f1eee48cc
|
|
@ -960,25 +960,28 @@ public class FileUtilsImpl implements FileInterface {
|
||||||
// Loop through all the directories and nested directories inside the pages directory to extract
|
// Loop through all the directories and nested directories inside the pages directory to extract
|
||||||
// pages, actions and actionCollections from the JSON files
|
// pages, actions and actionCollections from the JSON files
|
||||||
for (File page : Objects.requireNonNull(directory.listFiles())) {
|
for (File page : Objects.requireNonNull(directory.listFiles())) {
|
||||||
pageMap.put(page.getName(), readPageMetadata(page.toPath(), gson));
|
if (page.isDirectory()) {
|
||||||
|
pageMap.put(page.getName(), readPageMetadata(page.toPath(), gson));
|
||||||
|
|
||||||
JSONObject mainContainer = getMainContainer(pageMap.get(page.getName()), gson);
|
JSONObject mainContainer = getMainContainer(pageMap.get(page.getName()), gson);
|
||||||
|
|
||||||
// Read widgets data recursively from the widgets directory
|
// Read widgets data recursively from the widgets directory
|
||||||
Map<String, JSONObject> widgetsData = readWidgetsData(
|
Map<String, JSONObject> widgetsData = readWidgetsData(
|
||||||
page.toPath().resolve(CommonConstants.WIDGETS).toString());
|
page.toPath().resolve(CommonConstants.WIDGETS).toString());
|
||||||
// Construct the nested DSL from the widgets data
|
// Construct the nested DSL from the widgets data
|
||||||
Map<String, List<String>> parentDirectories = DSLTransformerHelper.calculateParentDirectories(
|
Map<String, List<String>> parentDirectories = DSLTransformerHelper.calculateParentDirectories(
|
||||||
widgetsData.keySet().stream().toList());
|
widgetsData.keySet().stream().toList());
|
||||||
JSONObject nestedDSL = DSLTransformerHelper.getNestedDSL(widgetsData, parentDirectories, mainContainer);
|
JSONObject nestedDSL =
|
||||||
pageDsl.put(page.getName(), nestedDSL.toString());
|
DSLTransformerHelper.getNestedDSL(widgetsData, parentDirectories, mainContainer);
|
||||||
actionMap.putAll(
|
pageDsl.put(page.getName(), nestedDSL.toString());
|
||||||
readAction(page.toPath().resolve(ACTION_DIRECTORY), gson, page.getName(), actionBodyMap));
|
actionMap.putAll(
|
||||||
actionCollectionMap.putAll(readActionCollection(
|
readAction(page.toPath().resolve(ACTION_DIRECTORY), gson, page.getName(), actionBodyMap));
|
||||||
page.toPath().resolve(ACTION_COLLECTION_DIRECTORY),
|
actionCollectionMap.putAll(readActionCollection(
|
||||||
gson,
|
page.toPath().resolve(ACTION_COLLECTION_DIRECTORY),
|
||||||
page.getName(),
|
gson,
|
||||||
actionCollectionBodyMap));
|
page.getName(),
|
||||||
|
actionCollectionBodyMap));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
applicationGitReference.setActions(actionMap);
|
applicationGitReference.setActions(actionMap);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user