Skip to content

Commit

Permalink
Merge branch 'master' into epic-primeng-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
nicobytes authored Aug 22, 2024
2 parents 7c3eee5 + 78dafd3 commit 78a8dd1
Show file tree
Hide file tree
Showing 3 changed files with 7,347 additions and 6,817 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public Map<String, Object> transform(final Field field, final Contentlet content
//This does always assume we're getting a fileAsset we don't want to miss a dotAsset
final Contentlet incoming = fileAsContentOptional.get();
if(incoming.isDotAsset()){
incoming.setProperty(FileAssetAPI.BINARY_FIELD, Try.of(()->incoming.getBinary("asset")).getOrNull());
fileAsset = convertToFileAsset(incoming, fileAssetAPI);
} else {
fileAsset = fileAssetAPI.fromContentlet(incoming);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,13 @@ public FileAsset fromContentlet(final Contentlet con) throws DotStateException {
throw new DotStateException("Content -> FileAsset Copy Failed :" + e.getMessage(), e);
}
fileAsset.setHost(con.getHost());
Contentlet originalContentlet = null;
if(UtilMethods.isSet(con.getFolder())){
try{
final Identifier ident = APILocator.getIdentifierAPI().find(con);
final Host host = APILocator.getHostAPI().find(con.getHost(), APILocator.systemUser() , false);
final Folder folder = APILocator.getFolderAPI().findFolderByPath(ident.getParentPath(), host, APILocator.systemUser(), false);
originalContentlet = APILocator.getContentletAPI().find(con.getInode(), APILocator.systemUser(), false);
fileAsset.setFolder(folder.getInode());
}catch(Exception e){
try{
Expand All @@ -285,7 +287,9 @@ public FileAsset fromContentlet(final Contentlet con) throws DotStateException {
}

fileAsset.setVariantId(con.getVariantId());
this.contentletCache.add(fileAsset);
if (null != originalContentlet && !originalContentlet.isDotAsset()){
this.contentletCache.add(fileAsset);
}
return fileAsset;
}

Expand Down
Loading

0 comments on commit 78a8dd1

Please sign in to comment.