mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
refactor(imex): check for overflow when adding blob size
Cannot happen without custom filesystem or sparse files, but removes clippy lint.
This commit is contained in:
@@ -166,7 +166,6 @@ impl BackupProvider {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[expect(clippy::arithmetic_side_effects)]
|
|
||||||
async fn handle_connection(
|
async fn handle_connection(
|
||||||
context: Context,
|
context: Context,
|
||||||
conn: iroh::endpoint::Connecting,
|
conn: iroh::endpoint::Connecting,
|
||||||
@@ -190,10 +189,11 @@ impl BackupProvider {
|
|||||||
|
|
||||||
let blobdir = BlobDirContents::new(&context).await?;
|
let blobdir = BlobDirContents::new(&context).await?;
|
||||||
|
|
||||||
let mut file_size = 0;
|
let mut file_size = dbfile.metadata()?.len();
|
||||||
file_size += dbfile.metadata()?.len();
|
|
||||||
for blob in blobdir.iter() {
|
for blob in blobdir.iter() {
|
||||||
file_size += blob.to_abs_path().metadata()?.len()
|
file_size = file_size
|
||||||
|
.checked_add(blob.to_abs_path().metadata()?.len())
|
||||||
|
.context("File size overflow")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
send_stream.write_all(&file_size.to_be_bytes()).await?;
|
send_stream.write_all(&file_size.to_be_bytes()).await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user