diff --git a/src/actions/config.js b/src/actions/config.js index 4a18a046..00082c97 100644 --- a/src/actions/config.js +++ b/src/actions/config.js @@ -70,12 +70,13 @@ function parseConfig(data) { } } - if ('media_folder' in config && typeof config.media_folder === 'string') { - // Parse source & public paths for media folder. - config.media_folder = { - path: config.media_folder, - public_path: config.media_folder - }; + if (!('public_folder' in config)) { + // Make sure there is a public folder + config.public_folder = config.media_folder; + } + + if (config.public_folder.charAt(0) !== '/') { + config.public_folder = '/' + config.public_folder; } return config; diff --git a/src/valueObjects/MediaProxy.js b/src/valueObjects/MediaProxy.js index 141b7441..04c56e6b 100644 --- a/src/valueObjects/MediaProxy.js +++ b/src/valueObjects/MediaProxy.js @@ -8,8 +8,8 @@ export default function MediaProxy(value, file, uploaded = false) { this.file = file; this.uploaded = uploaded; this.sha = null; - this.path = config.media_folder && !uploaded ? config.media_folder.path + '/' + value : value; - this.public_path = config.media_folder && !uploaded ? config.media_folder.public_path + '/' + value : value; + this.path = config.media_folder && !uploaded ? config.media_folder + '/' + value : value; + this.public_path = config.public_folder && !uploaded ? config.public_folder + '/' + value : value; } MediaProxy.prototype.toString = function() {