|
@@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
|
|
|
use std::fs::{File, metadata};
|
|
|
use std::io::{BufReader, Read};
|
|
|
use std::net::{IpAddr, SocketAddr};
|
|
|
+use std::path::PathBuf;
|
|
|
use std::str::FromStr;
|
|
|
use chrono::{DateTime, Utc};
|
|
|
use warp::Filter;
|
|
@@ -122,6 +123,7 @@ pub async fn get_attachments_info(folder: String, id: String) -> String{
|
|
|
attachments_info.push(AttachmentInfo{
|
|
|
name: entry.file_name().to_str().unwrap().to_string(),
|
|
|
size: file_size,
|
|
|
+ path
|
|
|
})
|
|
|
}
|
|
|
Err(_) => {}
|
|
@@ -288,7 +290,8 @@ struct GetAttachmentsInfoQuery {
|
|
|
#[derive(Deserialize, Serialize)]
|
|
|
struct AttachmentInfo{
|
|
|
pub name: String,
|
|
|
- pub size: u64
|
|
|
+ pub size: u64,
|
|
|
+ pub path: PathBuf
|
|
|
}
|
|
|
async fn get_attachments_info_handle(query: GetAttachmentsInfoQuery) -> Result<impl warp::Reply, warp::Rejection>{
|
|
|
let result: Vec<AttachmentInfo> = serde_json::from_str(&*get_attachments_info(query.folder, query.id).await).unwrap();
|