Use public_folder to display images persisted with no path reference

This commit is contained in:
Cássio Zen
2016-11-17 11:12:14 -02:00
parent d81d0d416f
commit 8d9f894928
4 changed files with 23 additions and 12 deletions

View File

@ -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);

View File

@ -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);
};