Merge pull request #181 from snshn/only-remove-credentals-from-http-urls
Only attempt to remove credentals from HTTP(S) URLs
This commit is contained in:
commit
65b5ff4ec0
1 changed files with 6 additions and 3 deletions
|
@ -160,9 +160,12 @@ fn main() {
|
|||
// Safe to unwrap (we just put this through an HTTP request)
|
||||
let mut clean_url = Url::parse(&base_url).unwrap();
|
||||
clean_url.set_fragment(None);
|
||||
// Don't include credentials
|
||||
clean_url.set_username("").unwrap();
|
||||
clean_url.set_password(None).unwrap();
|
||||
// Prevent credentials from getting into metadata
|
||||
if is_http_url(&base_url) {
|
||||
// Only HTTP(S) URLs may feature credentials
|
||||
clean_url.set_username("").unwrap();
|
||||
clean_url.set_password(None).unwrap();
|
||||
}
|
||||
let metadata_comment = if is_http_url(&base_url) {
|
||||
format!(
|
||||
"<!-- Saved from {} at {} using {} v{} -->\n",
|
||||
|
|
Loading…
Reference in a new issue