mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-27 11:34:14 +00:00
update redirection rule
This commit is contained in:
parent
137301200f
commit
37a0c8ff4d
@ -399,8 +399,7 @@ fn handle(
|
||||
Status::PermanentRedirect | Status::Redirect => {
|
||||
// Expected target URL in response meta
|
||||
match response.meta.data {
|
||||
Some(data) => {
|
||||
match uri.parse_relative(data.as_str(), UriFlags::NONE) {
|
||||
Some(data) => match uri.parse_relative(data.as_str(), UriFlags::NONE) {
|
||||
Ok(target) => {
|
||||
let total = redirects.take() + 1;
|
||||
|
||||
@ -414,7 +413,7 @@ fn handle(
|
||||
redirects.replace(0); // reset
|
||||
|
||||
// Disallow external redirection
|
||||
} else if uri.scheme() != target.scheme()
|
||||
} else if "gemini" != target.scheme()
|
||||
|| uri.port() != target.port()
|
||||
|| uri.host() != target.host() {
|
||||
let status = subject.page.content.to_status_failure();
|
||||
@ -442,7 +441,6 @@ fn handle(
|
||||
subject.page.title.replace(status.title());
|
||||
}
|
||||
}
|
||||
}
|
||||
None => {
|
||||
let status = subject.page.content.to_status_failure();
|
||||
status.set_description(Some("Redirection target not found"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user