Skip to content

Commit ffc0b5e

Browse files
[autofix.ci] apply automated fixes
1 parent b6c0f06 commit ffc0b5e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

server/api/registry/image-proxy/index.get.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ export default defineCachedEventHandler(
5656
const contentType = response.headers.get('content-type') || 'application/octet-stream'
5757

5858
// Only allow image content types
59-
if (!contentType.startsWith('image/') && !contentType.startsWith('application/octet-stream')) {
59+
if (
60+
!contentType.startsWith('image/') &&
61+
!contentType.startsWith('application/octet-stream')
62+
) {
6063
throw createError({
6164
statusCode: 400,
6265
message: 'URL does not point to an image.',

test/unit/shared/utils/image-proxy.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ import {
88
describe('Image Proxy Utils', () => {
99
describe('isTrustedImageDomain', () => {
1010
it('trusts GitHub raw content URLs', () => {
11-
expect(isTrustedImageDomain('https://raw.githubusercontent.com/owner/repo/main/img.png')).toBe(true)
11+
expect(
12+
isTrustedImageDomain('https://raw.githubusercontent.com/owner/repo/main/img.png'),
13+
).toBe(true)
1214
})
1315

1416
it('trusts GitHub user images', () => {
15-
expect(isTrustedImageDomain('https://user-images.githubusercontent.com/123/image.png')).toBe(true)
17+
expect(isTrustedImageDomain('https://user-images.githubusercontent.com/123/image.png')).toBe(
18+
true,
19+
)
1620
})
1721

1822
it('trusts shields.io badge URLs', () => {

0 commit comments

Comments
 (0)