code housekeeping
This commit is contained in:
parent
e1b6578b2a
commit
d3c3ff8e4e
10 changed files with 108 additions and 100 deletions
|
@ -6,14 +6,14 @@ use std::{net::Ipv4Addr, sync::Arc};
|
|||
|
||||
use axum::http::header::LOCATION;
|
||||
use axum::{
|
||||
Router,
|
||||
extract::{Path, Query, RawQuery, State},
|
||||
http::{
|
||||
header::{CACHE_CONTROL, CONTENT_TYPE},
|
||||
HeaderValue, StatusCode,
|
||||
header::{CACHE_CONTROL, CONTENT_TYPE},
|
||||
},
|
||||
response::{Html, IntoResponse, Response},
|
||||
routing::get,
|
||||
Router,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use tokio::net::TcpListener;
|
||||
|
@ -149,13 +149,12 @@ async fn branch(RawQuery(named_id): RawQuery, State(state): State<Arc<Server>>)
|
|||
});
|
||||
if let Some(branch_id) = branch_id {
|
||||
let branch = state.sources.treehouse.tree.branch(branch_id);
|
||||
if let Source::Tree { tree_path, .. } = state.sources.treehouse.source(branch.file_id) {
|
||||
if let Some(url) =
|
||||
if let Source::Tree { tree_path, .. } = state.sources.treehouse.source(branch.file_id)
|
||||
&& let Some(url) =
|
||||
vfs::url(&state.sources.config.site, &state.target.sync(), tree_path)
|
||||
{
|
||||
let url = format!("{url}#{}", branch.html_id);
|
||||
return (StatusCode::FOUND, [(LOCATION, url)]).into_response();
|
||||
}
|
||||
{
|
||||
let url = format!("{url}#{}", branch.html_id);
|
||||
return (StatusCode::FOUND, [(LOCATION, url)]).into_response();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue