mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Increased feature image alt text length to 191 chars
no issue - removed the 125 char soft limit so the full 191 char db field length can be used
This commit is contained in:
parent
9a93a5cfc6
commit
bb48d3623a
3 changed files with 40 additions and 3 deletions
|
@ -113,7 +113,7 @@ module.exports = {
|
|||
meta_description: {type: 'string', maxlength: 2000, nullable: true, validations: {isLength: {max: 500}}},
|
||||
email_subject: {type: 'string', maxlength: 300, nullable: true},
|
||||
frontmatter: {type: 'text', maxlength: 65535, nullable: true},
|
||||
feature_image_alt: {type: 'string', maxlength: 191, nullable: true, validations: {isLength: {max: 125}}},
|
||||
feature_image_alt: {type: 'string', maxlength: 191, nullable: true},
|
||||
feature_image_caption: {type: 'text', maxlength: 65535, nullable: true},
|
||||
email_only: {type: 'boolean', nullable: false, defaultTo: false}
|
||||
},
|
||||
|
@ -418,7 +418,7 @@ module.exports = {
|
|||
post_status: {type: 'string', maxlength: 50, nullable: true, validations: {isIn: [['draft', 'published', 'scheduled', 'sent']]}},
|
||||
reason: {type: 'string', maxlength: 50, nullable: true},
|
||||
feature_image: {type: 'string', maxlength: 2000, nullable: true},
|
||||
feature_image_alt: {type: 'string', maxlength: 191, nullable: true, validations: {isLength: {max: 125}}},
|
||||
feature_image_alt: {type: 'string', maxlength: 191, nullable: true},
|
||||
feature_image_caption: {type: 'text', maxlength: 65535, nullable: true},
|
||||
custom_excerpt: {type: 'string', maxlength: 2000, nullable: true, validations: {isLength: {max: 300}}}
|
||||
},
|
||||
|
|
|
@ -1457,6 +1457,24 @@ Object {
|
|||
}
|
||||
`;
|
||||
|
||||
exports[`Posts API Create Errors if feature_image_alt is too long 1: [body] 1`] = `
|
||||
Object {
|
||||
"errors": Array [
|
||||
Object {
|
||||
"code": null,
|
||||
"context": StringMatching /\\.\\*post_revisions\\\\\\.feature_image_alt\\] exceeds maximum length of 191 characters\\.\\*/,
|
||||
"details": null,
|
||||
"ghostErrorCode": null,
|
||||
"help": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{8\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{4\\}-\\[a-f0-9\\]\\{12\\}/,
|
||||
"message": "Validation error, cannot save post.",
|
||||
"property": null,
|
||||
"type": "ValidationError",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Posts API Create Errors with an invalid lexical state object 1: [body] 1`] = `
|
||||
Object {
|
||||
"errors": Array [
|
||||
|
|
|
@ -390,6 +390,25 @@ describe('Posts API', function () {
|
|||
});
|
||||
});
|
||||
|
||||
it('Errors if feature_image_alt is too long', async function () {
|
||||
const post = {
|
||||
title: 'Feature image alt too long',
|
||||
feature_image_alt: 'a'.repeat(201)
|
||||
};
|
||||
|
||||
await agent
|
||||
.post('/posts/?formats=mobiledoc,lexical,html')
|
||||
.body({posts: [post]})
|
||||
.expectStatus(422)
|
||||
.matchBodySnapshot({
|
||||
errors: [{
|
||||
id: anyErrorId,
|
||||
// TODO: this should be `posts.feature_image_alt` but we're hitting revision errors first
|
||||
context: stringMatching(/.*post_revisions\.feature_image_alt] exceeds maximum length of 191 characters.*/)
|
||||
}]
|
||||
});
|
||||
});
|
||||
|
||||
it('Clears all page html fields when creating published post', async function () {
|
||||
const totalPageCount = await models.Post.where({type: 'page'}).count();
|
||||
should.exist(totalPageCount, 'total page count');
|
||||
|
@ -877,7 +896,7 @@ describe('Posts API', function () {
|
|||
'content-version': anyContentVersion,
|
||||
etag: anyEtag
|
||||
});
|
||||
|
||||
|
||||
const convertedPost = conversionResponse.body.posts[0];
|
||||
const expectedConvertedLexical = convertedPost.lexical;
|
||||
await agent
|
||||
|
|
Loading…
Add table
Reference in a new issue