Skip to content

Commit ab5a1e7

Browse files
authored
Merge pull request #6565 from ampproject/enhancement/6536-add-featured-image-mime-types
Add WebP and SVG as accepted image formats for a post featured image
2 parents 2fd2574 + 0be1070 commit ab5a1e7

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

assets/src/common/components/higher-order/with-featured-image-notice.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default createHigherOrderComponent(
4040
return (
4141
<>
4242
<Notice
43-
status="notice"
43+
status="warning"
4444
isDismissible={ false }
4545
>
4646
{ errors.map( ( errorMessage, index ) => {

assets/src/common/helpers/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ export const validateFeaturedImage = ( media, dimensions, required ) => {
8787

8888
const errors = [];
8989

90-
if ( ! [ 'image/png', 'image/gif', 'image/jpeg' ].includes( media.mime_type ) ) {
90+
if ( ! [ 'image/png', 'image/gif', 'image/jpeg', 'image/webp', 'image/svg+xml' ].includes( media.mime_type ) ) {
9191
errors.push(
92-
/* translators: 1: .jpg, 2: .png. 3: .gif */
93-
sprintf( __( 'The featured image must be in %1$s, %2$s, or %3$s format.', 'amp' ), '.jpg', '.png', '.gif' ),
92+
/* translators: List of image formats */
93+
sprintf( __( 'The featured image must be of either %1$s, %2$s, %3$s, %4$s, or %5$s format.', 'amp' ), 'JPEG', 'PNG', 'GIF', 'WebP', 'SVG' ),
9494
);
9595
}
9696

assets/src/common/helpers/test/validateFeaturedImage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe( 'validateFeaturedImage', () => {
2020
{ width: 10, height: 10 },
2121
false,
2222
);
23-
expect( isValid ).toStrictEqual( [ 'The featured image must be in .jpg, .png, or .gif format.' ] );
23+
expect( isValid ).toStrictEqual( [ 'The featured image must be of either JPEG, PNG, GIF, WebP, or SVG format.' ] );
2424
} );
2525

2626
it( 'returns an error if the featured image is too small', () => {

0 commit comments

Comments
 (0)