|
@@ -2058,12 +2058,12 @@ impl Url {
|
|
|
let new_scheme_type = SchemeType::from(&parser.serialization);
|
|
let new_scheme_type = SchemeType::from(&parser.serialization);
|
|
|
let old_scheme_type = SchemeType::from(self.scheme());
|
|
let old_scheme_type = SchemeType::from(self.scheme());
|
|
|
// If url’s scheme is a special scheme and buffer is not a special scheme, then return.
|
|
// If url’s scheme is a special scheme and buffer is not a special scheme, then return.
|
|
|
- if new_scheme_type.is_special() && !old_scheme_type.is_special() ||
|
|
|
|
|
|
|
+ if (new_scheme_type.is_special() && !old_scheme_type.is_special()) ||
|
|
|
// If url’s scheme is not a special scheme and buffer is a special scheme, then return.
|
|
// If url’s scheme is not a special scheme and buffer is a special scheme, then return.
|
|
|
- !new_scheme_type.is_special() && old_scheme_type.is_special() ||
|
|
|
|
|
|
|
+ (!new_scheme_type.is_special() && old_scheme_type.is_special()) ||
|
|
|
// If url includes credentials or has a non-null port, and buffer is "file", then return.
|
|
// If url includes credentials or has a non-null port, and buffer is "file", then return.
|
|
|
// If url’s scheme is "file" and its host is an empty host or null, then return.
|
|
// If url’s scheme is "file" and its host is an empty host or null, then return.
|
|
|
- new_scheme_type.is_file() && self.has_authority()
|
|
|
|
|
|
|
+ (new_scheme_type.is_file() && self.has_authority())
|
|
|
{
|
|
{
|
|
|
return Err(());
|
|
return Err(());
|
|
|
}
|
|
}
|
|
@@ -2095,8 +2095,8 @@ impl Url {
|
|
|
|
|
|
|
|
// Update the port so it can be removed
|
|
// Update the port so it can be removed
|
|
|
// If it is the scheme's default
|
|
// If it is the scheme's default
|
|
|
- // We don't mind it silently failing
|
|
|
|
|
- // If there was no port in the first place
|
|
|
|
|
|
|
+ // we don't mind it silently failing
|
|
|
|
|
+ // if there was no port in the first place
|
|
|
let previous_port = self.port();
|
|
let previous_port = self.port();
|
|
|
let _ = self.set_port(previous_port);
|
|
let _ = self.set_port(previous_port);
|
|
|
|
|
|
|
@@ -2575,7 +2575,7 @@ fn file_url_segments_to_pathbuf(
|
|
|
}
|
|
}
|
|
|
// A windows drive letter must end with a slash.
|
|
// A windows drive letter must end with a slash.
|
|
|
if bytes.len() > 2 {
|
|
if bytes.len() > 2 {
|
|
|
- if matches!(bytes[bytes.len() -2], b'a'..=b'z' | b'A'..=b'Z')
|
|
|
|
|
|
|
+ if matches!(bytes[bytes.len() - 2], b'a'..=b'z' | b'A'..=b'Z')
|
|
|
&& matches!(bytes[bytes.len() - 1], b':' | b'|')
|
|
&& matches!(bytes[bytes.len() - 1], b':' | b'|')
|
|
|
{
|
|
{
|
|
|
bytes.push(b'/');
|
|
bytes.push(b'/');
|