Skip to content

Commit 7d52294

Browse files
committed
🔧 fix: mime is undefined when using Elysia.file in Web Standard Adapter
1 parent 216e70d commit 7d52294

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.3.20 - 24 Aug 2025
2+
Change:
3+
- mime is undefined when using `Elysia.file` in Web Standard Adapter
4+
15
# 1.3.19 - 24 Aug 2025
26
Change:
37
- [#1357](https://github.com/elysiajs/elysia/issues/1357) return `Response` proxy as-is

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "elysia",
33
"description": "Ergonomic Framework for Human",
4-
"version": "1.3.19",
4+
"version": "1.3.20",
55
"author": {
66
"name": "saltyAom",
77
"url": "https://github.com/SaltyAom",

src/adapter/web-standard/handler.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ import {
44
createResponseHandler,
55
createStreamHandler,
66
handleFile,
7-
handleSet,
8-
responseToSetHeaders,
9-
streamResponse
7+
handleSet
108
} from '../utils'
119

12-
import { ElysiaFile } from '../../universal/file'
10+
import { ElysiaFile, mime } from '../../universal/file'
1311
import { isNotEmpty } from '../../utils'
1412
import { Cookie } from '../../cookies'
1513
import { ElysiaCustomStatusResponse } from '../../error'
@@ -24,8 +22,9 @@ const handleElysiaFile = (
2422
}
2523
) => {
2624
const path = file.path
27-
// @ts-ignore
28-
const contentType = mime[path.slice(path.lastIndexOf('.') + 1)]
25+
const contentType =
26+
mime[path.slice(path.lastIndexOf('.') + 1) as any as keyof typeof mime]
27+
2928
if (contentType) set.headers['content-type'] = contentType
3029

3130
if (

0 commit comments

Comments
 (0)