mirror of
https://github.com/YGGverse/titanit.git
synced 2026-03-31 17:15:30 +00:00
build short uri
This commit is contained in:
parent
2532b3e11c
commit
a5e345eaa8
2 changed files with 20 additions and 1 deletions
13
src/main.rs
13
src/main.rs
|
|
@ -139,7 +139,18 @@ fn handle(argument: Arc<Argument>, peer: SocketAddr, stream: &mut TlsStream<TcpS
|
|||
Ok(_) => match tmp.commit() {
|
||||
Ok(pmt) => send(
|
||||
&response::redirect::Permanent {
|
||||
target: pmt.path.to_str().unwrap().to_owned(),
|
||||
target: match argument.redirect {
|
||||
Some(ref target) => format!(
|
||||
"{}/{}",
|
||||
target.trim_end_matches("/"),
|
||||
pmt.to_uri(&argument.directory)
|
||||
),
|
||||
None => format!(
|
||||
"gemini://{}/{}",
|
||||
argument.bind,
|
||||
pmt.to_uri(&argument.directory)
|
||||
)
|
||||
},
|
||||
}
|
||||
.into_bytes(),
|
||||
stream,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue