File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
server/api/registry/image-proxy Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff 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.' ,
Original file line number Diff line number Diff line change @@ -8,11 +8,15 @@ import {
88describe ( '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' , ( ) => {
You can’t perform that action at this time.
0 commit comments