Add check in StoreId::new() whether the local part is absolute
This commit is contained in:
parent
ccc2b6b735
commit
d1f07cd087
1 changed files with 9 additions and 2 deletions
|
@ -20,8 +20,15 @@ pub struct StoreId {
|
|||
|
||||
impl StoreId {
|
||||
|
||||
pub fn new(base: Option<PathBuf>, id: PathBuf) -> StoreId {
|
||||
StoreId { base: base, id: id }
|
||||
pub fn new(base: Option<PathBuf>, id: PathBuf) -> Result<StoreId> {
|
||||
if id.is_absolute() {
|
||||
Err(SEK::StoreIdLocalPartAbsoluteError.into_error())
|
||||
} else {
|
||||
Ok(StoreId {
|
||||
base: base,
|
||||
id: id
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub fn storified(self, store: &Store) -> StoreId {
|
||||
|
|
Loading…
Reference in a new issue