Skip to content

Commit

Permalink
Restore trailing slash behaviour in serve command (#2482)
Browse files Browse the repository at this point in the history
* Restore trailing slash behaviour in serve command.

* Restore guard in case where base_url is just a slash.
  • Loading branch information
jamwil authored May 3, 2024
1 parent 20f00ba commit 3423b8a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cmd/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,11 @@ fn create_new_site(
|u| u.to_string(),
);

let constructed_base_url = construct_url(&base_url, no_port_append, interface_port);
let mut constructed_base_url = construct_url(&base_url, no_port_append, interface_port);

if !site.config.base_url.ends_with("/") && constructed_base_url != "/" {
constructed_base_url.truncate(constructed_base_url.len() - 1);
}

site.enable_serve_mode();
site.set_base_url(constructed_base_url.clone());
Expand Down

0 comments on commit 3423b8a

Please sign in to comment.