vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit 2ee07ea1d8a7e42ca6532f461f2aeeec4db629be
parent 40c339db9bf197e4711f4a0438a0d06af44b919b
Author: Daniel GarcĂ­a <dani-garcia@users.noreply.github.com>
Date:   Sun, 15 Mar 2020 17:26:07 +0100

Fix empty data when cloning cipher

Diffstat:
Msrc/api/core/ciphers.rs | 31+++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs @@ -603,12 +603,14 @@ fn share_cipher_by_uuid( None => err!("Cipher doesn't exist"), }; + let mut shared_to_collection = false; + match data.Cipher.OrganizationId.clone() { // If we don't get an organization ID, we don't do anything // No error because this is used when using the Clone functionality - None => Ok(Json(cipher.to_json(&headers.host, &headers.user.uuid, &conn))), + None => {}, Some(organization_uuid) => { - let mut shared_to_collection = false; + for uuid in &data.CollectionIds { match Collection::find_by_uuid_and_org(uuid, &organization_uuid, &conn) { None => err!("Invalid collection ID provided"), @@ -622,19 +624,20 @@ fn share_cipher_by_uuid( } } } - update_cipher_from_data( - &mut cipher, - data.Cipher, - &headers, - shared_to_collection, - &conn, - &nt, - UpdateType::CipherUpdate, - )?; - - Ok(Json(cipher.to_json(&headers.host, &headers.user.uuid, &conn))) } - } + }; + + update_cipher_from_data( + &mut cipher, + data.Cipher, + &headers, + shared_to_collection, + &conn, + &nt, + UpdateType::CipherUpdate, + )?; + + Ok(Json(cipher.to_json(&headers.host, &headers.user.uuid, &conn))) } #[post("/ciphers/<uuid>/attachment", format = "multipart/form-data", data = "<data>")]