File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ fn x520_mapped_to_nothing(c: char) -> bool {
311
311
/// spaces as described in Section 7.6, because the characters needing removal
312
312
/// will vary across the matching rules and ASN.1 syntaxes used.
313
313
pub fn x520prep ( s : & str , case_fold : bool ) -> Result < Cow < ' _ , str > , Error > {
314
- if s. chars ( ) . all ( |c| matches ! ( c, ' ' ..='~' ) ) {
314
+ if s. chars ( ) . all ( |c| matches ! ( c, ' ' ..='~' ) && ( !case_fold || c . is_ascii_lowercase ( ) ) ) {
315
315
return Ok ( Cow :: Borrowed ( s) ) ;
316
316
}
317
317
@@ -399,6 +399,7 @@ mod test {
399
399
assert_eq ! ( x520prep( "foo@bar" , true ) . unwrap( ) , "foo@bar" ) ;
400
400
assert_eq ! ( x520prep( "J.\u{FE00} \u{9} W.\u{9} \u{B} wuz h\u{0115} re" , false ) . unwrap( ) , "J. W. wuz h\u{0115} re" ) ;
401
401
assert_eq ! ( x520prep( "J.\u{FE00} \u{9} W.\u{9} \u{B} wuz h\u{0115} re" , true ) . unwrap( ) , "j. w. wuz h\u{0115} re" ) ;
402
+ assert_eq ! ( x520prep( "UPPERCASED" , true ) . unwrap( ) , "uppercased" ) ;
402
403
assert_prohibited_character ( x520prep ( "\u{0306} hello" , true ) ) ;
403
404
}
404
405
You can’t perform that action at this time.
0 commit comments