mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
🐛 Fixed API v2 Settings browse returns relative image path (#10370)
closes #10363
This commit is contained in:
parent
732f97a074
commit
56db4ddd75
3 changed files with 25 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
const _ = require('lodash');
|
||||
const utils = require('../../index');
|
||||
const mapper = require('./utils/mapper');
|
||||
const _private = {};
|
||||
const deprecatedSettings = ['force_i18n', 'permalinks'];
|
||||
|
||||
|
@ -33,7 +34,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
frame.response = {
|
||||
settings: filteredSettings,
|
||||
settings: mapper.mapSettings(filteredSettings),
|
||||
meta: {}
|
||||
};
|
||||
|
||||
|
|
|
@ -70,6 +70,12 @@ const mapPost = (model, frame) => {
|
|||
return jsonModel;
|
||||
};
|
||||
|
||||
const mapSettings = (attrs) => {
|
||||
url.forSettings(attrs);
|
||||
return attrs;
|
||||
};
|
||||
|
||||
module.exports.mapPost = mapPost;
|
||||
module.exports.mapUser = mapUser;
|
||||
module.exports.mapTag = mapTag;
|
||||
module.exports.mapSettings = mapSettings;
|
||||
|
|
|
@ -63,6 +63,23 @@ const forTag = (id, attrs) => {
|
|||
return attrs;
|
||||
};
|
||||
|
||||
const forSettings = (attrs) => {
|
||||
if (attrs.cover_image) {
|
||||
attrs.cover_image = urlService.utils.urlFor('image', {image: attrs.cover_image}, true);
|
||||
}
|
||||
|
||||
if (attrs.logo) {
|
||||
attrs.logo = urlService.utils.urlFor('image', {image: attrs.logo}, true);
|
||||
}
|
||||
|
||||
if (attrs.icon) {
|
||||
attrs.icon = urlService.utils.urlFor('image', {image: attrs.icon}, true);
|
||||
}
|
||||
|
||||
return attrs;
|
||||
};
|
||||
|
||||
module.exports.forPost = forPost;
|
||||
module.exports.forUser = forUser;
|
||||
module.exports.forTag = forTag;
|
||||
module.exports.forSettings = forSettings;
|
||||
|
|
Loading…
Add table
Reference in a new issue