Skip to content

Commit

Permalink
#29259 include in 23.10.24 LTS
Browse files Browse the repository at this point in the history
  • Loading branch information
erickgonzalez committed Sep 4, 2024
1 parent 8a9cb35 commit a2a38d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dotCMS/hotfix_tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,5 @@ This maintenance release includes the following code fixes:
137. https://github.com/dotCMS/core/issues/29209 : Wrong url when exporting file asset #29209
138. https://github.com/dotCMS/core/issues/29222 : Telemetry: not getting data after last release of the plugin #29222
139. https://github.com/dotCMS/core/issues/29254 : Add a new main tag for LTSs #29254
140. https://github.com/dotCMS/core/issues/28857 : dotAsset is Breaking FileViewStrategy #28857
140. https://github.com/dotCMS/core/issues/28857 : dotAsset is Breaking FileViewStrategy #28857
141. https://github.com/dotCMS/core/issues/29259 : Page API: Image field content gone when request page with depth #29259
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,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

0 comments on commit a2a38d9

Please sign in to comment.