mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-01 02:41:39 -05:00
Reduced urlUtils dependency in ImageHandler
refs https://github.com/TryGhost/Toolbox/issues/523 - url-utils module is actively being stripped down from usages across codebase. The "urlUtils.STATIC_IMAGE_URL_PREFIX" and "store.staticFileURLPrefix" are the same values - the main difference is with the value coming from store we can make this module more generic for any store type (images, media, files, etc)
This commit is contained in:
parent
3119a5cc4c
commit
6c9e046b4b
1 changed files with 2 additions and 2 deletions
|
@ -15,7 +15,7 @@ ImageHandler = {
|
|||
const store = storage.getStorage('images');
|
||||
const baseDirRegex = baseDir ? new RegExp('^' + baseDir + '/') : new RegExp('');
|
||||
|
||||
const imageFolderRegexes = _.map(urlUtils.STATIC_IMAGE_URL_PREFIX.split('/'), function (dir) {
|
||||
const imageFolderRegexes = _.map(store.staticFileURLPrefix.split('/'), function (dir) {
|
||||
return new RegExp('^' + dir + '/');
|
||||
});
|
||||
|
||||
|
@ -36,7 +36,7 @@ ImageHandler = {
|
|||
|
||||
return Promise.all(files.map(function (image) {
|
||||
return store.getUniqueFileName(image, image.targetDir).then(function (targetFilename) {
|
||||
image.newPath = urlUtils.urlJoin('/', urlUtils.getSubdir(), urlUtils.STATIC_IMAGE_URL_PREFIX,
|
||||
image.newPath = urlUtils.urlJoin('/', urlUtils.getSubdir(), store.staticFileURLPrefix,
|
||||
path.relative(config.getContentPath('images'), targetFilename));
|
||||
|
||||
return image;
|
||||
|
|
Loading…
Add table
Reference in a new issue