1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Serve /apple-touch-icon-120x120.png (#37667)

This commit is contained in:
Peter Bengtsson
2023-06-08 11:46:01 -04:00
committed by GitHub
parent 510eb08e18
commit 59c58f3eb4
2 changed files with 22 additions and 8 deletions

View File

@@ -17,15 +17,23 @@ const MAP = {
contentType: 'image/png',
buffer: getBuffer('assets/images/site/apple-touch-icon.png'),
},
'/apple-touch-icon-120x120.png': {
contentType: 'image/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.
'/apple-touch-icon-precomposed.png': {
contentType: 'image/png',
buffer: getBuffer('assets/images/site/apple-touch-icon.png'),
},
}
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

View File

@@ -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')
})