forked from vitejs/vite
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: s.deny with globs with directories (vitejs#16250)
- Loading branch information
1 parent
bfc5649
commit d0a1224
Showing
6 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
packages/playground/fs-serve/__tests__/deny/fs-serve-deny.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { describe, expect, test } from 'vitest' | ||
import { isServe, page, viteTestUrl } from '~utils' | ||
|
||
describe.runIf(isServe)('main', () => { | ||
test('**/deny/** should deny src/deny/deny.txt', async () => { | ||
const res = await page.request.fetch( | ||
new URL('/src/deny/deny.txt', viteTestUrl).href, | ||
) | ||
expect(res.status()).toBe(403) | ||
}) | ||
test('**/deny/** should deny src/deny/.deny', async () => { | ||
const res = await page.request.fetch( | ||
new URL('/src/deny/.deny', viteTestUrl).href, | ||
) | ||
expect(res.status()).toBe(403) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.deny |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deny |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import path from 'node:path' | ||
import { defineConfig } from 'vite' | ||
|
||
export default defineConfig({ | ||
build: { | ||
rollupOptions: { | ||
input: { | ||
main: path.resolve(__dirname, 'src/index.html'), | ||
}, | ||
}, | ||
}, | ||
server: { | ||
fs: { | ||
strict: true, | ||
allow: [path.resolve(__dirname, 'src')], | ||
deny: ['**/deny/**'], | ||
}, | ||
}, | ||
define: { | ||
ROOT: JSON.stringify(path.dirname(__dirname).replace(/\\/g, '/')), | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters