1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-11-26 05:50:29 +01:00

Fix empty data when cloning cipher

Dieser Commit ist enthalten in:
Daniel García 2020-03-15 17:26:07 +01:00
Ursprung 40c339db9b
Commit 2ee07ea1d8
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: FC8A7D14C3CD543A

Datei anzeigen

@ -603,12 +603,14 @@ fn share_cipher_by_uuid(
None => err!("Cipher doesn't exist"), None => err!("Cipher doesn't exist"),
}; };
let mut shared_to_collection = false;
match data.Cipher.OrganizationId.clone() { match data.Cipher.OrganizationId.clone() {
// If we don't get an organization ID, we don't do anything // If we don't get an organization ID, we don't do anything
// No error because this is used when using the Clone functionality // 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) => { Some(organization_uuid) => {
let mut shared_to_collection = false;
for uuid in &data.CollectionIds { for uuid in &data.CollectionIds {
match Collection::find_by_uuid_and_org(uuid, &organization_uuid, &conn) { match Collection::find_by_uuid_and_org(uuid, &organization_uuid, &conn) {
None => err!("Invalid collection ID provided"), 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>")] #[post("/ciphers/<uuid>/attachment", format = "multipart/form-data", data = "<data>")]