From 76ae03c954db687eb587863b95efc515c87c98ca Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Thu, 9 Apr 2015 04:27:24 +0300 Subject: [PATCH] An empty password should be saved as None, not empty string --- src/urlutils.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/urlutils.rs b/src/urlutils.rs index ffb15665..cd57b501 100644 --- a/src/urlutils.rs +++ b/src/urlutils.rs @@ -65,6 +65,10 @@ impl<'a> UrlUtils for UrlUtilsWrapper<'a> { fn set_password(&mut self, input: &str) -> ParseResult<()> { match self.url.scheme_data { SchemeData::Relative(RelativeSchemeData { ref mut password, .. }) => { + if input.len() == 0 { + *password = None; + return Ok(()); + } let mut new_password = String::new(); utf8_percent_encode_to(input, PASSWORD_ENCODE_SET, &mut new_password); *password = Some(new_password);