Skip to content

Commit 674e444

Browse files
authored
respond with cipher json when deleting attachments (#5823)
1 parent 0d16da4 commit 674e444

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/api/core/ciphers.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ async fn delete_attachment_post_admin(
13761376
headers: Headers,
13771377
conn: DbConn,
13781378
nt: Notify<'_>,
1379-
) -> EmptyResult {
1379+
) -> JsonResult {
13801380
delete_attachment(cipher_id, attachment_id, headers, conn, nt).await
13811381
}
13821382

@@ -1387,7 +1387,7 @@ async fn delete_attachment_post(
13871387
headers: Headers,
13881388
conn: DbConn,
13891389
nt: Notify<'_>,
1390-
) -> EmptyResult {
1390+
) -> JsonResult {
13911391
delete_attachment(cipher_id, attachment_id, headers, conn, nt).await
13921392
}
13931393

@@ -1398,7 +1398,7 @@ async fn delete_attachment(
13981398
headers: Headers,
13991399
mut conn: DbConn,
14001400
nt: Notify<'_>,
1401-
) -> EmptyResult {
1401+
) -> JsonResult {
14021402
_delete_cipher_attachment_by_id(&cipher_id, &attachment_id, &headers, &mut conn, &nt).await
14031403
}
14041404

@@ -1409,7 +1409,7 @@ async fn delete_attachment_admin(
14091409
headers: Headers,
14101410
mut conn: DbConn,
14111411
nt: Notify<'_>,
1412-
) -> EmptyResult {
1412+
) -> JsonResult {
14131413
_delete_cipher_attachment_by_id(&cipher_id, &attachment_id, &headers, &mut conn, &nt).await
14141414
}
14151415

@@ -1818,7 +1818,7 @@ async fn _delete_cipher_attachment_by_id(
18181818
headers: &Headers,
18191819
conn: &mut DbConn,
18201820
nt: &Notify<'_>,
1821-
) -> EmptyResult {
1821+
) -> JsonResult {
18221822
let Some(attachment) = Attachment::find_by_id(attachment_id, conn).await else {
18231823
err!("Attachment doesn't exist")
18241824
};
@@ -1847,19 +1847,20 @@ async fn _delete_cipher_attachment_by_id(
18471847
)
18481848
.await;
18491849

1850-
if let Some(org_id) = cipher.organization_uuid {
1850+
if let Some(ref org_id) = cipher.organization_uuid {
18511851
log_event(
18521852
EventType::CipherAttachmentDeleted as i32,
18531853
&cipher.uuid,
1854-
&org_id,
1854+
org_id,
18551855
&headers.user.uuid,
18561856
headers.device.atype,
18571857
&headers.ip.ip,
18581858
conn,
18591859
)
18601860
.await;
18611861
}
1862-
Ok(())
1862+
let cipher_json = cipher.to_json(&headers.host, &headers.user.uuid, None, CipherSyncType::User, conn).await;
1863+
Ok(Json(json!({"cipher":cipher_json})))
18631864
}
18641865

18651866
/// This will hold all the necessary data to improve a full sync of all the ciphers

0 commit comments

Comments
 (0)