Check in Store::move_by_id() whether target exists, not only in cache but also on FS
This commit is contained in:
parent
29e1107d3e
commit
a01a2c18f8
1 changed files with 4 additions and 0 deletions
|
@ -755,6 +755,10 @@ impl Store {
|
||||||
let old_id_pb = try!(old_id.clone().with_base(self.path().clone()).into_pathbuf());
|
let old_id_pb = try!(old_id.clone().with_base(self.path().clone()).into_pathbuf());
|
||||||
let new_id_pb = try!(new_id.clone().with_base(self.path().clone()).into_pathbuf());
|
let new_id_pb = try!(new_id.clone().with_base(self.path().clone()).into_pathbuf());
|
||||||
|
|
||||||
|
if try!(self.backend.exists(&new_id_pb)) {
|
||||||
|
return Err(SE::from_kind(SEK::EntryAlreadyExists(new_id.clone())));
|
||||||
|
}
|
||||||
|
|
||||||
match self.backend.rename(&old_id_pb, &new_id_pb) {
|
match self.backend.rename(&old_id_pb, &new_id_pb) {
|
||||||
Err(e) => return Err(e).chain_err(|| SEK::EntryRenameError(old_id_pb, new_id_pb)),
|
Err(e) => return Err(e).chain_err(|| SEK::EntryRenameError(old_id_pb, new_id_pb)),
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
|
|
Loading…
Reference in a new issue