File tree 1 file changed +6
-0
lines changed
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -2088,6 +2088,9 @@ impl Url {
2088
2088
pub fn set_password ( & mut self , password : Option < & str > ) -> Result < ( ) , ( ) > {
2089
2089
// has_host implies !cannot_be_a_base
2090
2090
if !self . has_host ( ) || self . host ( ) == Some ( Host :: Domain ( "" ) ) || self . scheme ( ) == "file" {
2091
+ if password. is_none ( ) || password == Some ( "" ) {
2092
+ return Ok ( ( ) ) ;
2093
+ }
2091
2094
return Err ( ( ) ) ;
2092
2095
}
2093
2096
let password = password. unwrap_or_default ( ) ;
@@ -2182,6 +2185,9 @@ impl Url {
2182
2185
pub fn set_username ( & mut self , username : & str ) -> Result < ( ) , ( ) > {
2183
2186
// has_host implies !cannot_be_a_base
2184
2187
if !self . has_host ( ) || self . host ( ) == Some ( Host :: Domain ( "" ) ) || self . scheme ( ) == "file" {
2188
+ if username. is_empty ( ) {
2189
+ return Ok ( ( ) ) ;
2190
+ }
2185
2191
return Err ( ( ) ) ;
2186
2192
}
2187
2193
let username_start = self . scheme_end + 3 ;
You can’t perform that action at this time.
0 commit comments