update redirection rule

This commit is contained in:
yggverse 2025-01-22 20:53:00 +02:00
parent 137301200f
commit 37a0c8ff4d

View File

@ -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"));