Merge pull request #158 from matthiasbeyer/libimagstore/fix-157
Fix: seek() file back on reading it
This commit is contained in:
commit
15549c0ee0
1 changed files with 5 additions and 2 deletions
|
@ -7,7 +7,7 @@ use std::sync::Arc;
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
use std::io::{Seek, SeekFrom};
|
||||||
|
|
||||||
use fs2::FileExt;
|
use fs2::FileExt;
|
||||||
use toml::{Table, Value};
|
use toml::{Table, Value};
|
||||||
|
@ -63,7 +63,10 @@ impl StoreEntry {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO:
|
// TODO:
|
||||||
Entry::from_file(self.id.clone(), file.unwrap())
|
let mut file = file.unwrap();
|
||||||
|
let entry = Entry::from_file(self.id.clone(), &mut file);
|
||||||
|
file.seek(SeekFrom::Start(0));
|
||||||
|
entry
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Err(StoreError::new(StoreErrorKind::EntryAlreadyBorrowed, None))
|
return Err(StoreError::new(StoreErrorKind::EntryAlreadyBorrowed, None))
|
||||||
|
|
Loading…
Reference in a new issue