Seek file from beginning on encrypted header
This commit is contained in:
parent
5143dff888
commit
92a66e60dc
1 changed files with 2 additions and 1 deletions
3
src/cache/fs.rs
vendored
3
src/cache/fs.rs
vendored
|
@ -30,7 +30,7 @@ use sodiumoxide::crypto::secretstream::{
|
||||||
Header, Pull, Push, Stream as SecretStream, Tag, HEADERBYTES,
|
Header, Pull, Push, Stream as SecretStream, Tag, HEADERBYTES,
|
||||||
};
|
};
|
||||||
use tokio::fs::{create_dir_all, remove_file, File};
|
use tokio::fs::{create_dir_all, remove_file, File};
|
||||||
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, ReadBuf};
|
use tokio::io::{AsyncRead, AsyncReadExt, AsyncSeekExt, AsyncWrite, AsyncWriteExt, ReadBuf};
|
||||||
use tokio::sync::mpsc::Sender;
|
use tokio::sync::mpsc::Sender;
|
||||||
use tokio_util::codec::{BytesCodec, FramedRead};
|
use tokio_util::codec::{BytesCodec, FramedRead};
|
||||||
|
|
||||||
|
@ -88,6 +88,7 @@ async fn read_file(
|
||||||
debug!("Found not encrypted file");
|
debug!("Found not encrypted file");
|
||||||
} else {
|
} else {
|
||||||
let mut file = File::from_std(file_1);
|
let mut file = File::from_std(file_1);
|
||||||
|
file.seek(SeekFrom::Start(0)).await.ok()?;
|
||||||
let file_0 = file.try_clone().await.unwrap();
|
let file_0 = file.try_clone().await.unwrap();
|
||||||
|
|
||||||
// image is encrypted or corrupt
|
// image is encrypted or corrupt
|
||||||
|
|
Loading…
Reference in a new issue