Move id format check from server into notmuch
This commit is contained in:
@@ -29,7 +29,7 @@ use serde::Deserialize;
|
||||
use sqlx::postgres::PgPool;
|
||||
use tokio::{net::TcpListener, sync::Mutex};
|
||||
use tower_http::trace::{DefaultMakeSpan, TraceLayer};
|
||||
use tracing::{info, warn};
|
||||
use tracing::info;
|
||||
|
||||
// Make our own error that wraps `anyhow::Error`.
|
||||
struct AppError(letterbox_server::ServerError);
|
||||
@@ -148,12 +148,7 @@ async fn view_original(
|
||||
extract::Path(id): extract::Path<String>,
|
||||
) -> Result<impl IntoResponse, AppError> {
|
||||
info!("view_original {id}");
|
||||
let mid = if id.starts_with("id:") {
|
||||
id
|
||||
} else {
|
||||
format!("id:{id}")
|
||||
};
|
||||
let bytes = nm.show_original(&mid)?;
|
||||
let bytes = nm.show_original(&id)?;
|
||||
let s = String::from_utf8_lossy(&bytes).to_string();
|
||||
Ok(s.into_response())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user