File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -131,8 +131,17 @@ fn decode_inner(c: &str, full_url: bool) -> DecodeResult<String> {
131
131
}
132
132
} ;
133
133
134
+ let bytes_from_hex = match Vec :: < u8 > :: from_hex ( & bytes) {
135
+ Ok ( b) => b,
136
+ _ => {
137
+ return Err ( "Malformed input: found '%' followed by \
138
+ invalid hex values. Character '%' must \
139
+ escaped.". to_owned ( ) )
140
+ }
141
+ } ;
142
+
134
143
// Only decode some characters if full_url:
135
- match Vec :: < u8 > :: from_hex ( & bytes ) . unwrap ( ) [ 0 ] as char {
144
+ match bytes_from_hex [ 0 ] as char {
136
145
// gen-delims:
137
146
':' |
138
147
'/' |
Original file line number Diff line number Diff line change @@ -938,6 +938,11 @@ fn test_get_opt_wrong_type() {
938
938
}
939
939
}
940
940
941
+ #[ test]
942
+ fn url_unencoded_password ( ) {
943
+ assert ! ( "postgresql://username:password%1*@localhost" . into_connect_params( ) . is_err( ) )
944
+ }
945
+
941
946
#[ test]
942
947
fn url_encoded_password ( ) {
943
948
let params = "postgresql://username%7b%7c:password%7b%7c@localhost" . into_connect_params ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments