geforkt von mirrored/vaultwarden
Fix FolderCipher creation, handle some errors
Dieser Commit ist enthalten in:
Ursprung
514a372bc8
Commit
c3be1b4298
3 geänderte Dateien mit 12 neuen und 8 gelöschten Zeilen
|
@ -174,7 +174,9 @@ fn update_cipher_from_data(cipher: &mut Cipher, data: CipherData, headers: &Head
|
||||||
// Copy the type data and change the names to the correct case
|
// Copy the type data and change the names to the correct case
|
||||||
copy_values(&type_data, &mut values);
|
copy_values(&type_data, &mut values);
|
||||||
|
|
||||||
cipher.move_to_folder(data.folderId, &headers.user.uuid, &conn);
|
if cipher.move_to_folder(data.folderId, &headers.user.uuid, &conn).is_err() {
|
||||||
|
err!("Error saving the folder information")
|
||||||
|
}
|
||||||
cipher.name = data.name;
|
cipher.name = data.name;
|
||||||
cipher.notes = data.notes;
|
cipher.notes = data.notes;
|
||||||
cipher.fields = uppercase_fields.map(|f| f.to_string());
|
cipher.fields = uppercase_fields.map(|f| f.to_string());
|
||||||
|
@ -429,7 +431,9 @@ fn move_cipher_selected(data: Json<Value>, headers: Headers, conn: DbConn) -> Em
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move cipher
|
// Move cipher
|
||||||
cipher.move_to_folder(folder_id.clone(), &headers.user.uuid, &conn);
|
if cipher.move_to_folder(folder_id.clone(), &headers.user.uuid, &conn).is_err() {
|
||||||
|
err!("Error saving the folder information")
|
||||||
|
}
|
||||||
cipher.save(&conn);
|
cipher.save(&conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,10 +163,10 @@ impl Cipher {
|
||||||
current_folder.delete(&conn).or(Err("Failed removing old folder mapping"))
|
current_folder.delete(&conn).or(Err("Failed removing old folder mapping"))
|
||||||
},
|
},
|
||||||
None => Ok(()) // Weird, but nothing to do
|
None => Ok(()) // Weird, but nothing to do
|
||||||
};
|
}.and_then(
|
||||||
|
|()| FolderCipher::new(&new_folder, &self.uuid)
|
||||||
FolderCipher::new(&new_folder, &self.uuid)
|
.save(&conn).or(Err("Couldn't save folder setting"))
|
||||||
.save(&conn).or(Err("Couldn't save folder setting"))
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
|
|
|
@ -55,10 +55,10 @@ impl Folder {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FolderCipher {
|
impl FolderCipher {
|
||||||
pub fn new(cipher_uuid: &str, folder_uuid: &str) -> Self {
|
pub fn new(folder_uuid: &str, cipher_uuid: &str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
cipher_uuid: cipher_uuid.to_string(),
|
|
||||||
folder_uuid: folder_uuid.to_string(),
|
folder_uuid: folder_uuid.to_string(),
|
||||||
|
cipher_uuid: cipher_uuid.to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Laden …
In neuem Issue referenzieren