Skip to content

Commit

Permalink
Allow 'url join' to print username without password
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Westhaver committed Jan 31, 2024
1 parent d40019a commit 15a2c67
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions crates/nu-command/src/network/url/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,11 @@ impl UrlComponents {
}

pub fn to_url(&self, span: Span) -> Result<String, ShellError> {
let mut user_and_pwd: String = String::from("");

if let Some(usr) = &self.username {
if let Some(pwd) = &self.password {
user_and_pwd = format!("{usr}:{pwd}@");
}
}
let user_and_pwd = match (&self.username, &self.password) {
(Some(usr), Some(pwd)) => format!("{usr}:{pwd}@"),
(Some(usr), None) => format!("{usr}@"),
_ => String::from(""),
};

let scheme_result = match &self.scheme {
Some(s) => Ok(s),
Expand Down

0 comments on commit 15a2c67

Please sign in to comment.