(Try to) Fix calculating file size
This commit is contained in:
parent
d109e3f034
commit
e5c9ff3aed
|
@ -612,14 +612,13 @@ pub async fn upload_worker(
|
||||||
let total_size = file.seek(SeekFrom::End(0)).await.unwrap();
|
let total_size = file.seek(SeekFrom::End(0)).await.unwrap();
|
||||||
file.seek(SeekFrom::Start(0)).await.unwrap();
|
file.seek(SeekFrom::Start(0)).await.unwrap();
|
||||||
let parts = (total_size as f64 / (2000.0 * 1024.0 * 1024.0)).ceil() as usize;
|
let parts = (total_size as f64 / (2000.0 * 1024.0 * 1024.0)).ceil() as usize;
|
||||||
let current_position = 0;
|
|
||||||
for i in 0..parts {
|
for i in 0..parts {
|
||||||
let filename = if parts == 1 {
|
let filename = if parts == 1 {
|
||||||
video_filename.clone()
|
video_filename.clone()
|
||||||
} else {
|
} else {
|
||||||
format!("{}.part{:02}", &video_filename, i)
|
format!("{}.part{:02}", &video_filename, i)
|
||||||
};
|
};
|
||||||
let mut size = total_size - current_position;
|
let mut size = file.stream_position().await.unwrap();
|
||||||
if size > 2000 * 1024 * 1024 {
|
if size > 2000 * 1024 * 1024 {
|
||||||
size = 2000 * 1024 * 1024;
|
size = 2000 * 1024 * 1024;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue