This commit is contained in:
Edward Shen 2022-01-15 16:55:47 -08:00
parent c2bdd089e9
commit bccf84cfc1
Signed by: edward
GPG key ID: 19182661E818369F
2 changed files with 3 additions and 4 deletions

View file

@ -97,7 +97,7 @@ async fn main() -> Result<()> {
.route("/:code", get(|| async { INDEX_PAGE })) .route("/:code", get(|| async { INDEX_PAGE }))
.nest("/static", root_service) .nest("/static", root_service)
.route( .route(
&format!("{}{}", API_ENDPOINT.to_string(), "/:code"), &format!("{}{}", API_ENDPOINT, "/:code"),
get(paste::<SHORT_CODE_SIZE>).delete(delete::<SHORT_CODE_SIZE>), get(paste::<SHORT_CODE_SIZE>).delete(delete::<SHORT_CODE_SIZE>),
) )
.layer(AddExtensionLayer::new(db)) .layer(AddExtensionLayer::new(db))

View file

@ -94,9 +94,8 @@ fn main() {
error!("Key is missing in url; bailing."); error!("Key is missing in url; bailing.");
render_message("Invalid paste link: Missing metadata.".into()); render_message("Invalid paste link: Missing metadata.".into());
return; return;
} else {
fragment
} }
fragment
} else { } else {
error!("Key is missing in url; bailing."); error!("Key is missing in url; bailing.");
render_message("Invalid paste link: Missing metadata.".into()); render_message("Invalid paste link: Missing metadata.".into());
@ -107,7 +106,7 @@ fn main() {
Ok(partial_parsed_url) => partial_parsed_url, Ok(partial_parsed_url) => partial_parsed_url,
Err(e) => { Err(e) => {
error!("Failed to parse text fragment; bailing."); error!("Failed to parse text fragment; bailing.");
render_message(format!("Invalid paste link: {}", e.to_string()).into()); render_message(format!("Invalid paste link: {}", e).into());
return; return;
} }
}; };