Avoid panic for file url (#3306)

When using find links with a file url, we shouldn't panic because we
can't remove username/password for a host-less url.

See #3262
This commit is contained in:
konsti 2024-04-29 16:39:16 +02:00 committed by GitHub
parent 1344cfae4b
commit cedb8259f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,8 +32,8 @@ impl CanonicalUrl {
} }
// Strip credentials. // Strip credentials.
url.set_password(None).unwrap(); let _ = url.set_password(None);
url.set_username("").unwrap(); let _ = url.set_username("");
// Strip a trailing slash. // Strip a trailing slash.
if url.path().ends_with('/') { if url.path().ends_with('/') {