add file extensions to downloads, fixes #397

This commit is contained in:
Cooper Quintin
2025-06-18 09:36:52 -07:00
committed by Will Greenberg
parent f2ff1be2ec
commit 0b0dd4ed43
2 changed files with 7 additions and 4 deletions
+5 -2
View File
@@ -21,12 +21,15 @@ use tokio_util::io::ReaderStream;
// pcap data to a channel that's piped to the client.
pub async fn get_pcap(
State(state): State<Arc<ServerState>>,
Path(qmdl_name): Path<String>,
Path(mut qmdl_name): Path<String>,
) -> Result<Response, (StatusCode, String)> {
let qmdl_store = state.qmdl_store_lock.read().await;
if qmdl_name.ends_with("pcapng") {
qmdl_name = qmdl_name.trim_end_matches(".pcapng").to_string();
}
let (entry_index, entry) = qmdl_store.entry_for_name(&qmdl_name).ok_or((
StatusCode::NOT_FOUND,
format!("couldn't find qmdl file with name {}", qmdl_name),
format!("couldn't find manifest entry with name {}", qmdl_name),
))?;
if entry.qmdl_size_bytes == 0 {
return Err((