Skip to content

Commit 05fc15b

Browse files
committed
fix: allow svg in image-proxy
1 parent 7833db6 commit 05fc15b

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,8 @@ export default defineEventHandler(async event => {
164164

165165
const contentType = response.headers.get('content-type') || 'application/octet-stream'
166166

167-
// Only allow raster/vector image content types, but block SVG to prevent
168-
// embedded JavaScript execution (SVGs can contain <script> tags, event handlers, etc.)
169-
if (!contentType.startsWith('image/') || contentType.includes('svg')) {
167+
// Allow raster/vector image content types (we don't inject external content into DOM, so SVG is allowed too)
168+
if (!contentType.startsWith('image/')) {
170169
await response.body?.cancel()
171170
return {place: 'contentType', url, sig, reqUrl: event.node.req.url, reqOrigUrl: event.node.req.originalUrl}
172171
// throw createError({

0 commit comments

Comments
 (0)