Skip to content

Commit

Permalink
hotfix: avoid fatal error if file not found in asset.getFilesToCommit()
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Jul 7, 2022
1 parent 29fe6bb commit 8393476
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions lib/metadataTypes/Asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -1370,18 +1370,22 @@ class Asset extends MetadataType {
break;
}
}
const metadata = File.readJSONFile(filePath, fileName, true, false);
const fileListNested = (
await this._mergeCode(metadata, basePath, subType, metadata.customerKey)
).map((item) =>
File.normalizePath([
basePath,
...item.subFolder,
`${item.fileName}.${item.fileExt}`,
])
);
if (await File.pathExists(File.normalizePath([...filePath, fileName]))) {
const metadata = File.readJSONFile(filePath, fileName, true, false);
const fileListNested = (
await this._mergeCode(metadata, basePath, subType, metadata.customerKey)
).map((item) =>
File.normalizePath([
basePath,
...item.subFolder,
`${item.fileName}.${item.fileExt}`,
])
);

return [File.normalizePath([...filePath, fileName]), ...fileListNested];
return [File.normalizePath([...filePath, fileName]), ...fileListNested];
} else {
return [];
}
})
)
).flat();
Expand Down

0 comments on commit 8393476

Please sign in to comment.