@@ -2018,10 +2018,10 @@ impl<Fs: FileSystem> ResolverGeneric<Fs> {
2018
2018
// 2. Assert: keyB ends with "/" or contains only a single "*".
2019
2019
debug_assert ! ( key_b. ends_with( '/' ) || key_b. match_indices( '*' ) . count( ) == 1 , "{key_b}" ) ;
2020
2020
// 3. Let baseLengthA be the index of "*" in keyA plus one, if keyA contains "*", or the length of keyA otherwise.
2021
- let a_pos = key_a. chars ( ) . position ( |c| c == '*' ) ;
2021
+ let a_pos = key_a. bytes ( ) . position ( |c| c == b '*') ;
2022
2022
let base_length_a = a_pos. map_or ( key_a. len ( ) , |p| p + 1 ) ;
2023
2023
// 4. Let baseLengthB be the index of "*" in keyB plus one, if keyB contains "*", or the length of keyB otherwise.
2024
- let b_pos = key_b. chars ( ) . position ( |c| c == '*' ) ;
2024
+ let b_pos = key_b. bytes ( ) . position ( |c| c == b '*') ;
2025
2025
let base_length_b = b_pos. map_or ( key_b. len ( ) , |p| p + 1 ) ;
2026
2026
// 5. If baseLengthA is greater than baseLengthB, return -1.
2027
2027
if base_length_a > base_length_b {
@@ -2032,11 +2032,11 @@ impl<Fs: FileSystem> ResolverGeneric<Fs> {
2032
2032
return Ordering :: Greater ;
2033
2033
}
2034
2034
// 7. If keyA does not contain "*", return 1.
2035
- if !key_a . contains ( '*' ) {
2035
+ if a_pos . is_none ( ) {
2036
2036
return Ordering :: Greater ;
2037
2037
}
2038
2038
// 8. If keyB does not contain "*", return -1.
2039
- if !key_b . contains ( '*' ) {
2039
+ if b_pos . is_none ( ) {
2040
2040
return Ordering :: Less ;
2041
2041
}
2042
2042
// 9. If the length of keyA is greater than the length of keyB, return -1.
0 commit comments