mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
fix(resolver): resolve query and fragments with unicode filenames (#1591)
This commit is contained in:
parent
a6142558ce
commit
085021ab85
3 changed files with 8 additions and 1 deletions
0
crates/oxc_resolver/fixtures/enhanced_resolve/test/fixtures/测试.js
vendored
Normal file
0
crates/oxc_resolver/fixtures/enhanced_resolve/test/fixtures/测试.js
vendored
Normal file
|
|
@ -34,7 +34,7 @@ impl<'a> Specifier<'a> {
|
|||
|
||||
let mut prev = specifier.chars().next().unwrap();
|
||||
let mut escaped_indexes = vec![];
|
||||
for (i, c) in specifier.chars().enumerate().skip(skip) {
|
||||
for (i, c) in specifier.char_indices().skip(skip) {
|
||||
if c == '?' {
|
||||
query_start = Some(i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,12 @@ fn resolve() {
|
|||
("file with fragment", f.clone(), "./main1.js#fragment", f.join("main1.js#fragment")),
|
||||
("file with fragment and query", f.clone(), "./main1.js#fragment?query", f.join("main1.js#fragment?query")),
|
||||
("file with query and fragment", f.clone(), "./main1.js?#fragment", f.join("main1.js?#fragment")),
|
||||
|
||||
("file with query (unicode)", f.clone(), "./测试.js?query", f.join("测试.js?query")),
|
||||
("file with fragment (unicode)", f.clone(), "./测试.js#fragment", f.join("测试.js#fragment")),
|
||||
("file with fragment and query (unicode)", f.clone(), "./测试.js#fragment?query", f.join("测试.js#fragment?query")),
|
||||
("file with query and fragment (unicode)", f.clone(), "./测试.js?#fragment", f.join("测试.js?#fragment")),
|
||||
|
||||
("file in module with query", f.clone(), "m1/a?query", f.join("node_modules/m1/a.js?query")),
|
||||
("file in module with fragment", f.clone(), "m1/a#fragment", f.join("node_modules/m1/a.js#fragment")),
|
||||
("file in module with fragment and query", f.clone(), "m1/a#fragment?query", f.join("node_modules/m1/a.js#fragment?query")),
|
||||
|
|
@ -43,6 +49,7 @@ fn resolve() {
|
|||
("handle fragment edge case (no fragment)", f.clone(), "./no#fragment/#/#", f.join("no#fragment/#/#.js")),
|
||||
("handle fragment edge case (fragment)", f.clone(), "./no#fragment/#/", f.join("no.js#fragment/#/")),
|
||||
("handle fragment escaping", f.clone(), "./no\0#fragment/\0#/\0##fragment", f.join("no#fragment/#/#.js#fragment")),
|
||||
|
||||
];
|
||||
|
||||
for (comment, path, request, expected) in pass {
|
||||
|
|
|
|||
Loading…
Reference in a new issue