master
veypi 11 months ago
parent 16fa27bc49
commit 3f3681b037

@ -35,8 +35,8 @@ async fn save_files(
dir = "tmp".to_string();
}
let mut res: Vec<String> = Vec::new();
form.files.into_iter().for_each(|v| {
let fname = v.file_name.unwrap_or("unknown".to_string());
for v in form.files.into_iter() {
let fname = v.file_name.clone().unwrap_or("unknown".to_string());
let root = Path::new(&stat.media_path).join(dir.clone());
if !root.exists() {
match fs::create_dir_all(root.clone()) {
@ -52,8 +52,8 @@ async fn save_files(
t.id,
fname
);
info!("saving to {temp_file}");
match v.file.persist(temp_file) {
info!("saving {:?} to {temp_file}", v.file.path().to_str());
match fs::copy(v.file.path(), &temp_file) {
Ok(p) => {
info!("{:#?}", p);
res.push(format!("/media/{}/{}.{}", dir, t.id, fname))
@ -62,7 +62,7 @@ async fn save_files(
warn!("{}", e);
}
};
});
}
Ok(web::Json(res))
}

@ -281,7 +281,6 @@ pub fn init_log(stat: &AppState) -> Option<tracing_appender::non_blocking::Worke
.with_max_level(level)
.with_ansi(false)
.init();
info!("asd");
Some(_guard)
} else {
tracing_subscriber::fmt()

@ -530,10 +530,10 @@
resolved "https://registry.yarnpkg.com/@veypi/msg/-/msg-0.1.1.tgz#94864ae2c0a81991b8a30d87f12d2245fdebbead"
integrity sha512-UiAF/Y0EGT/37tGApptzHBNUpo78LbnrEkCqGAGMkJp86wrUyOgTAvuvQ197Ifqw9PIbjZM9dAgMv4DfMJQEYA==
"@veypi/oaer@^0.0.9":
version "0.0.9"
resolved "https://registry.yarnpkg.com/@veypi/oaer/-/oaer-0.0.9.tgz#b47d9bd635dfaa3df1d756e6c132f717969f60e2"
integrity sha512-YmyykQW6Kw4XeQ47/ogObSx3JotfX08Kali3GoN4eOGl2Sa++q+kqkDq+2IFmdw0P9naZ+pzu7OChjo7TjZuHg==
"@veypi/oaer@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@veypi/oaer/-/oaer-0.2.0.tgz#c360bcc308545232d0bb2d4d01bfdc75cc6392a6"
integrity sha512-fYudEZ1zAY6lxXEIGcLnRoUXVk9hDEd6MEiZ2pKu5Ly9fEBjyO8u86y+5aIUlyTu/PSPDsKmC5kVVBJqVQx/Qw==
dependencies:
"@veypi/msg" "^0.1.0"
"@veypi/one-icon" "2"

Loading…
Cancel
Save