From 51cd1ad1570d44b720b5f99da560829e175bb03d Mon Sep 17 00:00:00 2001 From: heulitig Date: Tue, 7 Nov 2023 12:58:44 +0530 Subject: [PATCH] fixing base href (wip) --- fastn-core/src/commands/serve.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fastn-core/src/commands/serve.rs b/fastn-core/src/commands/serve.rs index 0bbf40fc35..c98274982e 100644 --- a/fastn-core/src/commands/serve.rs +++ b/fastn-core/src/commands/serve.rs @@ -93,10 +93,18 @@ async fn serve_file( if fastn_core::utils::is_ftd_path(path.as_str()) { return fastn_core::http::ok(main_document.content.as_bytes().to_vec()); } + let mut base_url = "/".to_string(); + base_url.push_str( + path.as_str() + .trim_end_matches("/") + .trim_start_matches("/") + .trim_start_matches("index.html") + .trim_start_matches("index"), + ); match fastn_core::package::package_doc::read_ftd( config, &main_document, - "/", + base_url.as_str(), false, false, )