Skip to content

Commit

Permalink
chore: include hotfix-18014 (#26144)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsolistorres committed Sep 17, 2023
1 parent 1660f8c commit 606d358
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.dotmarketing.portlets.fileassets.business.IFileAsset;
import com.dotmarketing.portlets.languagesmanager.business.LanguageAPI;
import com.dotmarketing.util.InodeUtils;
import com.dotmarketing.util.Logger;
import com.dotmarketing.util.UtilMethods;

import org.apache.velocity.tools.view.tools.ViewTool;
Expand All @@ -34,6 +35,11 @@ public IFileAsset getFile(String identifier, boolean live, long languageId) thro
Identifier id = identifierAPI.find(identifier);
ContentletVersionInfo cvi = APILocator.getVersionableAPI().getContentletVersionInfo(id.getId(), languageId);
String conInode = (!live) ? cvi.getWorkingInode() : cvi.getLiveInode();
if (!UtilMethods.isSet(conInode)) {
Logger.velocityWarn(FileTool.class, "There's not a live version for the file asset "
+ " id: " + identifier + ", lang: " + languageId);
return null;
}
FileAsset file = APILocator.getFileAssetAPI().fromContentlet(APILocator.getContentletAPI().find(conInode, userAPI.getSystemUser(), false));
return file;
}
Expand Down

0 comments on commit 606d358

Please sign in to comment.