Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit91641c4

Browse files
committed
fix: fs deny for case insensitive systems (#15653)
1 parentef89f80 commit91641c4

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

‎packages/vite/src/node/server/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,10 @@ export async function _createServer(
617617
_importGlobMap:newMap(),
618618
_forceOptimizeOnRestart:false,
619619
_pendingRequests:newMap(),
620-
_fsDenyGlob:picomatch(config.server.fs.deny,{matchBase:true}),
620+
_fsDenyGlob:picomatch(config.server.fs.deny,{
621+
matchBase:true,
622+
nocase:true,
623+
}),
621624
_shortcutsOptions:undefined,
622625
}
623626

‎playground/fs-serve/__tests__/base/fs-serve-base.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,13 @@ describe.runIf(isServe)('main', () => {
9292
})
9393

9494
test('denied',async()=>{
95-
expect(awaitpage.textContent('.unsafe-dotenv')).toBe('404')
95+
expect(awaitpage.textContent('.unsafe-dotenv')).toBe('403')
96+
})
97+
98+
test('denied EnV casing',async()=>{
99+
// It is 403 in case insensitive system, 404 in others
100+
constcode=awaitpage.textContent('.unsafe-dotEnV-casing')
101+
expect(code==='403'||code==='404').toBeTruthy()
96102
})
97103
})
98104

‎playground/fs-serve/__tests__/fs-serve.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,13 @@ describe.runIf(isServe)('main', () => {
9292
})
9393

9494
test('denied',async()=>{
95-
expect(awaitpage.textContent('.unsafe-dotenv')).toBe('404')
95+
expect(awaitpage.textContent('.unsafe-dotenv')).toBe('403')
96+
})
97+
98+
test('denied EnV casing',async()=>{
99+
// It is 403 in case insensitive system, 404 in others
100+
constcode=awaitpage.textContent('.unsafe-dotEnV-casing')
101+
expect(code==='403'||code==='404').toBeTruthy()
96102
})
97103
})
98104

‎playground/fs-serve/root/src/index.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ <h2>Nested Entry</h2>
4545

4646
<h2>Denied</h2>
4747
<preclass="unsafe-dotenv"></pre>
48+
<preclass="unsafe-dotEnV-casing"></pre>
4849

4950
<scripttype="module">
5051
import'../../entry'
@@ -236,14 +237,27 @@ <h2>Denied</h2>
236237
})
237238

238239
// .env, denied by default
239-
fetch(joinUrlSegments(base,joinUrlSegments('/@fs/',ROOT)+'/root/.env'))
240+
fetch(
241+
joinUrlSegments(base,joinUrlSegments('/@fs/',ROOT)+'/root/src/.env'),
242+
)
240243
.then((r)=>{
241244
text('.unsafe-dotenv',r.status)
242245
})
243246
.catch((e)=>{
244247
console.error(e)
245248
})
246249

250+
// .env, for case insensitive file systems
251+
fetch(
252+
joinUrlSegments(base,joinUrlSegments('/@fs/',ROOT)+'/root/src/.EnV'),
253+
)
254+
.then((r)=>{
255+
text('.unsafe-dotEnV-casing',r.status)
256+
})
257+
.catch((e)=>{
258+
console.error(e)
259+
})
260+
247261
functiontext(sel,text){
248262
document.querySelector(sel).textContent=text
249263
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp