chore: 📎 + fmt
This commit is contained in:
@@ -27,7 +27,7 @@ where
|
||||
T: Read + Write,
|
||||
{
|
||||
let filename = &path[prefix.len()..];
|
||||
info!("file request for {} with method {}", filename, method);
|
||||
info!("file request for {filename} with method {method}");
|
||||
Ok(match method {
|
||||
Method::Delete => {
|
||||
let mut board = BOARD_ACCESS.get().await.lock().await;
|
||||
@@ -65,7 +65,7 @@ where
|
||||
&[
|
||||
("Content-Type", "application/octet-stream"),
|
||||
("Content-Disposition", disposition.as_str()),
|
||||
("Content-Length", &format!("{}", size)),
|
||||
("Content-Length", &format!("{size}")),
|
||||
("Access-Control-Allow-Origin", "*"),
|
||||
("Access-Control-Allow-Headers", "*"),
|
||||
("Access-Control-Allow-Methods", "*"),
|
||||
@@ -84,16 +84,16 @@ where
|
||||
.await?;
|
||||
let length = read_chunk.1;
|
||||
if length == 0 {
|
||||
info!("file request for {} finished", filename);
|
||||
info!("file request for {filename} finished");
|
||||
break;
|
||||
}
|
||||
let data = &read_chunk.0[0..length];
|
||||
conn.write_all(data).await?;
|
||||
if length < read_chunk.0.len() {
|
||||
info!("file request for {} finished", filename);
|
||||
info!("file request for {filename} finished");
|
||||
break;
|
||||
}
|
||||
chunk = chunk + 1;
|
||||
chunk += 1;
|
||||
}
|
||||
BOARD_ACCESS
|
||||
.get()
|
||||
@@ -120,8 +120,8 @@ where
|
||||
let mut chunk = 0;
|
||||
loop {
|
||||
let buf = read_up_to_bytes_from_request(conn, Some(4096)).await?;
|
||||
if buf.len() == 0 {
|
||||
info!("file request for {} finished", filename);
|
||||
if buf.is_empty() {
|
||||
info!("file request for {filename} finished");
|
||||
break;
|
||||
} else {
|
||||
let mut board = BOARD_ACCESS.get().await.lock().await;
|
||||
@@ -132,8 +132,8 @@ where
|
||||
.write_file(filename.to_owned(), offset as u32, &buf)
|
||||
.await?;
|
||||
}
|
||||
offset = offset + buf.len();
|
||||
chunk = chunk + 1;
|
||||
offset += buf.len();
|
||||
chunk += 1;
|
||||
}
|
||||
BOARD_ACCESS
|
||||
.get()
|
||||
|
||||
Reference in New Issue
Block a user