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 {
311311/// spaces as described in Section 7.6, because the characters needing removal
312312/// will vary across the matching rules and ASN.1 syntaxes used.
313313pub 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 ( ) ) ) {
315315 return Ok ( Cow :: Borrowed ( s) ) ;
316316 }
317317
@@ -399,6 +399,7 @@ mod test {
399399 assert_eq ! ( x520prep( "foo@bar" , true ) . unwrap( ) , "foo@bar" ) ;
400400 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" ) ;
401401 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" ) ;
402403 assert_prohibited_character ( x520prep ( "\u{0306} hello" , true ) ) ;
403404 }
404405
You can’t perform that action at this time.
0 commit comments