Serve /apple-touch-icon-120x120.png (#37667)
This commit is contained in:
@@ -17,16 +17,24 @@ const MAP = {
|
||||
contentType: 'image/png',
|
||||
buffer: getBuffer('assets/images/site/apple-touch-icon.png'),
|
||||
},
|
||||
// It's the same image but it's fine. By default, when Safari tries to
|
||||
// to figure out which apple touch icons are available it will
|
||||
// try to load this by default. For example, if you in desktop Safari
|
||||
// click share icon, it will load this to serve as a preview icon.
|
||||
'/apple-touch-icon-precomposed.png': {
|
||||
'/apple-touch-icon-120x120.png': {
|
||||
contentType: 'image/png',
|
||||
buffer: getBuffer('assets/images/site/apple-touch-icon.png'),
|
||||
buffer: getBuffer('assets/images/site/apple-touch-icon-120x120.png'),
|
||||
},
|
||||
'/apple-touch-icon-152x152.png': {
|
||||
contentType: 'image/png',
|
||||
buffer: getBuffer('assets/images/site/apple-touch-icon-152x152.png'),
|
||||
},
|
||||
}
|
||||
|
||||
// It's the same image but it's fine. By default, when Safari tries to
|
||||
// to figure out which apple touch icons are available it will
|
||||
// try to load this by default. For example, if you in desktop Safari
|
||||
// click share icon, it will load this to serve as a preview icon.
|
||||
MAP['/apple-touch-icon-precomposed.png'] = MAP['/apple-touch-icon.png']
|
||||
MAP['/apple-touch-icon-120x120-precomposed.png'] = MAP['/apple-touch-icon-120x120.png']
|
||||
MAP['/apple-touch-icon-152x152-precomposed.png'] = MAP['/apple-touch-icon-152x152.png']
|
||||
|
||||
function getBuffer(filePath) {
|
||||
let buffer
|
||||
if (!fs.existsSync(filePath)) {
|
||||
|
||||
@@ -38,8 +38,14 @@ describe('favicon assets', () => {
|
||||
expect(res.headers['surrogate-key']).toBe(SURROGATE_ENUMS.MANUAL)
|
||||
})
|
||||
|
||||
test('should also 200 OK on /apple-touch-icon-precomposed.png', async () => {
|
||||
const res = await get('/apple-touch-icon-precomposed.png')
|
||||
test.each([
|
||||
'/apple-touch-icon-precomposed.png',
|
||||
'/apple-touch-icon-120x120-precomposed.png',
|
||||
'/apple-touch-icon-120x120.png',
|
||||
'/apple-touch-icon-152x152.png',
|
||||
'/apple-touch-icon-152x152-precomposed.png',
|
||||
])('should also 200 OK on %s', async (path) => {
|
||||
const res = await get(path)
|
||||
expect(res.statusCode).toBe(200)
|
||||
expect(res.headers['content-type']).toBe('image/png')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user