Skip to content

Commit 4d12f68

Browse files
committed
🔧 fix: remove trailing slash on windows
1 parent 006fe7e commit 4d12f68

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.4.7 - 17 Nov 2025
2+
Bug fix:
3+
- remove trailing slash on Windows
4+
15
# 1.4.6 - 3 Nov 2025
26
Bug fix:
37
- normalize path only when unsafe

example/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import { Elysia } from 'elysia'
22
import { staticPlugin } from '../src/index'
33

4-
const app = new Elysia().use(await staticPlugin()).listen(3000)
4+
const app = new Elysia()
5+
.use(
6+
await staticPlugin({
7+
prefix: '/'
8+
})
9+
)
10+
.listen(3000)
11+
12+
console.log(app.routes)
513

614
await app.modules

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@elysiajs/static",
3-
"version": "1.4.6",
3+
"version": "1.4.7",
44
"license": "MIT",
55
"scripts": {
66
"dev": "bun run --watch example/index.ts",

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export async function staticPlugin<const Prefix extends string = '/prefix'>({
245245
}
246246

247247
app.onError(() => {}).get(
248-
`${prefix}/*`,
248+
`${prefix.endsWith('/') ? prefix.slice(0, -1) : prefix}/*`,
249249
async ({ params, headers: requestHeaders }) => {
250250
const pathName = normalizePath(
251251
path.join(

0 commit comments

Comments
 (0)