Use public_folder to display images persisted with no path reference
This commit is contained in:
@ -46,4 +46,4 @@ export const selectIntegration = (state, collection, hook) =>
|
||||
fromIntegrations.selectIntegration(state.integrations, collection, hook);
|
||||
|
||||
export const getMedia = (state, path) =>
|
||||
fromMedias.getMedia(state.medias, path);
|
||||
fromMedias.getMedia(state.config.get('public_folder'), state.medias, path);
|
||||
|
@ -16,10 +16,14 @@ const medias = (state = Map(), action) => {
|
||||
|
||||
export default medias;
|
||||
|
||||
export const getMedia = (state, path) => {
|
||||
export const getMedia = (publicFolder, state, path) => {
|
||||
if (state.has(path)) {
|
||||
return state.get(path);
|
||||
} else {
|
||||
return new MediaProxy(path, null, true);
|
||||
}
|
||||
|
||||
let localPath = path;
|
||||
if (path && path.indexOf('/') === -1) {
|
||||
localPath = `/${ publicFolder }/${ localPath }`;
|
||||
}
|
||||
return new MediaProxy(localPath, null, true);
|
||||
};
|
||||
|
Reference in New Issue
Block a user