diff --git a/dotCMS/src/main/java/com/dotmarketing/servlets/ShortyServlet.java b/dotCMS/src/main/java/com/dotmarketing/servlets/ShortyServlet.java index 568a31ded0c3..44eda30ecf8a 100644 --- a/dotCMS/src/main/java/com/dotmarketing/servlets/ShortyServlet.java +++ b/dotCMS/src/main/java/com/dotmarketing/servlets/ShortyServlet.java @@ -539,10 +539,17 @@ protected final String inodePath(final Contentlet contentlet, if (contentletVersionInfo.isPresent()) { Logger.debug(this, "Contentlet version found for identifier: " + relatedImageId); - final Contentlet imageContentlet = getImageContentlet(contentletVersionInfo.get(), live); - validateContentlet(imageContentlet, live, imageContentlet.getInode()); - final String fieldVar = imageContentlet.isDotAsset() ? DotAssetContentType.ASSET_FIELD_VAR : FILE_ASSET_DEFAULT; - return buildFieldPath(imageContentlet, fieldVar); + final String inode = live + ? contentletVersionInfo.get().getLiveInode() + : contentletVersionInfo.get().getWorkingInode(); + try{ + final Contentlet imageContentlet = APILocator.getContentletAPI().find(inode, APILocator.systemUser(), false); + validateContentlet(imageContentlet, live, inode); + final String fieldVar = imageContentlet.isDotAsset() ? DotAssetContentType.ASSET_FIELD_VAR : FILE_ASSET_DEFAULT; + return buildFieldPath(imageContentlet, fieldVar); + }catch (DotDataException e){ + Logger.debug(this.getClass(), e.getMessage()); + } } Logger.debug(this, "No contentlet version found for identifier: " + relatedImageId + ", returning path based on original contentlet inode: " + contentlet.getInode()); } @@ -562,22 +569,6 @@ private boolean shouldFallbackToDefaultLanguage(final Contentlet contentlet) { APILocator.getLanguageAPI().getDefaultLanguage().getId() != contentlet.getLanguageId(); } - /** - * Retrieves the appropriate contentlet version (live or working) for an image - * based on the provided version info. - * - * @param versionInfo The version information for the contentlet - * @param live Whether to retrieve the live version (true) or working version (false) - * @return The requested version of the contentlet - * @throws DotDataException If there's an error accessing the data - * @throws DotSecurityException If there's a security violation - */ - private Contentlet getImageContentlet(final ContentletVersionInfo versionInfo, final boolean live) - throws DotDataException, DotSecurityException { - final String inode = live ? versionInfo.getLiveInode() : versionInfo.getWorkingInode(); - return APILocator.getContentletAPI().find(inode, APILocator.systemUser(), false); - } - /** * Constructs a standardized field path for a contentlet and field variable. * The path format is: /[contentlet-inode]/[field-variable]