-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle paths with special characters in injectQuery (fix #2585)
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
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,37 @@ | ||
import { injectQuery } from '../utils' | ||
|
||
test('normalize windows path', () => { | ||
expect(injectQuery('C:\\User\\Vite\\Project', 'direct')).toEqual( | ||
'C:/User/Vite/Project?direct' | ||
) | ||
}) | ||
|
||
test('path with multiple spaces', () => { | ||
expect(injectQuery('/usr/vite/path with space', 'direct')).toEqual( | ||
'/usr/vite/path with space?direct' | ||
) | ||
}) | ||
|
||
test('path with multiple % characters', () => { | ||
expect(injectQuery('/usr/vite/not%20a%20space', 'direct')).toEqual( | ||
'/usr/vite/not%20a%20space?direct' | ||
) | ||
}) | ||
|
||
test('path with %25', () => { | ||
expect(injectQuery('/usr/vite/%25hello%25', 'direct')).toEqual( | ||
'/usr/vite/%25hello%25?direct' | ||
) | ||
}) | ||
|
||
test('path with unicode', () => { | ||
expect(injectQuery('/usr/vite/東京', 'direct')).toEqual( | ||
'/usr/vite/東京?direct' | ||
) | ||
}) | ||
|
||
test('path with unicode, space, and %', () => { | ||
expect(injectQuery('/usr/vite/東京 %20 hello', 'direct')).toEqual( | ||
'/usr/vite/東京 %20 hello?direct' | ||
) | ||
}) |
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