mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
Fixed external media inliner logs
refs https://github.com/TryGhost/Toolbox/issues/524 - The "tableName" property is not present on the bookshelf model instance - it was a mistake assumption using it for logs. In case the logs are too ambiguous we could figure pass around model names separately into the "inlineSimpleFields" method
This commit is contained in:
parent
6fa00faaa2
commit
46508b7299
2 changed files with 3 additions and 7 deletions
|
@ -187,7 +187,7 @@ class ExternalMediaInliner {
|
||||||
* @param {string[]} domains - domains to inline media from
|
* @param {string[]} domains - domains to inline media from
|
||||||
*/
|
*/
|
||||||
async #inlineSimpleFields(resources, model, fields, domains) {
|
async #inlineSimpleFields(resources, model, fields, domains) {
|
||||||
logging.info(`Starting inlining external media for ${resources?.length} ${model.tableName}`);
|
logging.info(`Starting inlining external media for ${resources?.length} resources and with ${fields.join(', ')} fields`);
|
||||||
|
|
||||||
for (const resource of resources) {
|
for (const resource of resources) {
|
||||||
try {
|
try {
|
||||||
|
@ -202,7 +202,7 @@ class ExternalMediaInliner {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logging.error(`Error inlining media for ${model.tableName}: ${resource.id}`);
|
logging.error(`Error inlining media for: ${resource.id}`);
|
||||||
logging.error(new errors.DataImportError({
|
logging.error(new errors.DataImportError({
|
||||||
err
|
err
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -23,28 +23,24 @@ describe('ExternalMediaInliner', function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
postModelStub = {
|
postModelStub = {
|
||||||
tableName: 'posts',
|
|
||||||
findPage: sinon.stub().resolves({
|
findPage: sinon.stub().resolves({
|
||||||
data: []
|
data: []
|
||||||
}),
|
}),
|
||||||
edit: sinon.stub().resolves()
|
edit: sinon.stub().resolves()
|
||||||
};
|
};
|
||||||
postMetaModelStub = {
|
postMetaModelStub = {
|
||||||
tableName: 'posts_meta',
|
|
||||||
findPage: sinon.stub().resolves({
|
findPage: sinon.stub().resolves({
|
||||||
data: []
|
data: []
|
||||||
}),
|
}),
|
||||||
edit: sinon.stub().resolves()
|
edit: sinon.stub().resolves()
|
||||||
};
|
};
|
||||||
tagModelStub = {
|
tagModelStub = {
|
||||||
tableName: 'tags',
|
|
||||||
findPage: sinon.stub().resolves({
|
findPage: sinon.stub().resolves({
|
||||||
data: []
|
data: []
|
||||||
}),
|
}),
|
||||||
edit: sinon.stub().resolves()
|
edit: sinon.stub().resolves()
|
||||||
};
|
};
|
||||||
userModelStub = {
|
userModelStub = {
|
||||||
tableName: 'users',
|
|
||||||
findPage: sinon.stub().resolves({
|
findPage: sinon.stub().resolves({
|
||||||
data: []
|
data: []
|
||||||
}),
|
}),
|
||||||
|
@ -335,7 +331,7 @@ describe('ExternalMediaInliner', function () {
|
||||||
|
|
||||||
assert.ok(requestMock.isDone());
|
assert.ok(requestMock.isDone());
|
||||||
assert.ok(tagModelStub.edit.calledOnce);
|
assert.ok(tagModelStub.edit.calledOnce);
|
||||||
assert.equal(logging.error.args[0][0], 'Error inlining media for tags: errored-tag-id');
|
assert.equal(logging.error.args[0][0], 'Error inlining media for: errored-tag-id');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('inlines image in the post\'s feature_image field', async function () {
|
it('inlines image in the post\'s feature_image field', async function () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue