Skip to content

Commit

Permalink
fix: external urls in images
Browse files Browse the repository at this point in the history
  • Loading branch information
pnicolli committed Aug 24, 2023
1 parent abe599e commit 39429d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/Image/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { flattenToAppURL, isInternalURL } from '@plone/volto/helpers';
import config from '@plone/volto/registry';

const getImageIsFromBrain = (imageDownloadUrl) => {
if (typeof imageDownloadUrl !== 'string') return false;
// Old check against itemUrl truthyness isn't valid anymore.
// All brains have item[@id], need to check if image.download
// starts with @@images
Expand Down Expand Up @@ -47,7 +48,7 @@ export const getImageAttributes = (
// while regular content objects have scales with full urls (i.e. https://.../@@images/...)
let itemPath = flattenToAppURL(itemUrl ?? '');
if (itemPath.slice(-1) !== '/') itemPath = `${itemPath}/`;
const isFromBrain = getImageIsFromBrain(image?.download);
const isFromBrain = getImageIsFromBrain(image?.download ?? image);

const imageScales = config.settings.imageScales;

Expand Down

0 comments on commit 39429d6

Please sign in to comment.