mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-09-14 16:02:05 +00:00
auto-append missed trailing slash to the root locations
This commit is contained in:
parent
9198f2a4f5
commit
2f4cc8f00f
@ -30,10 +30,6 @@ impl Nex {
|
|||||||
cancellable: Cancellable,
|
cancellable: Cancellable,
|
||||||
is_snap_history: bool,
|
is_snap_history: bool,
|
||||||
) {
|
) {
|
||||||
if is_snap_history {
|
|
||||||
self.page.snap_history();
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
self.page
|
self.page
|
||||||
.navigation
|
.navigation
|
||||||
@ -43,6 +39,27 @@ impl Nex {
|
|||||||
.set_request(Some(uri.to_string()));
|
.set_request(Some(uri.to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let path = uri.path(); // copy once
|
||||||
|
|
||||||
|
if path.is_empty() {
|
||||||
|
let r = format!("{uri}/"); // auto-append missed trailing slash to the root locations
|
||||||
|
{
|
||||||
|
let mut i = self.page.navigation.request.info.take();
|
||||||
|
i.set_header(Some(r.clone()));
|
||||||
|
self.page
|
||||||
|
.navigation
|
||||||
|
.request
|
||||||
|
.info
|
||||||
|
.replace(i.into_permanent_redirect());
|
||||||
|
}
|
||||||
|
self.page.navigation.set_request(&r);
|
||||||
|
self.page.item_action.load.activate(Some(&r), false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_snap_history {
|
||||||
|
self.page.snap_history();
|
||||||
|
}
|
||||||
|
|
||||||
let socket = SocketClient::new();
|
let socket = SocketClient::new();
|
||||||
socket.set_protocol(SocketProtocol::Tcp);
|
socket.set_protocol(SocketProtocol::Tcp);
|
||||||
socket.set_timeout(30); // @TODO optional
|
socket.set_timeout(30); // @TODO optional
|
||||||
@ -109,7 +126,7 @@ impl Nex {
|
|||||||
// panic as unexpected.
|
// panic as unexpected.
|
||||||
}
|
}
|
||||||
c.output_stream().write_all_async(
|
c.output_stream().write_all_async(
|
||||||
format!("{}\r\n", uri.path()),
|
format!("{path}\r\n"),
|
||||||
Priority::DEFAULT,
|
Priority::DEFAULT,
|
||||||
Some(&cancellable.clone()),
|
Some(&cancellable.clone()),
|
||||||
move |r| match r {
|
move |r| match r {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user