mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2024-11-11 00:00:59 +00:00
Fix error with adding file attachment from org vault view
This commit is contained in:
parent
c666497130
commit
91e80657e4
@ -783,10 +783,7 @@ struct AttachmentRequestData {
|
|||||||
Key: String,
|
Key: String,
|
||||||
FileName: String,
|
FileName: String,
|
||||||
FileSize: i32,
|
FileSize: i32,
|
||||||
// We check org owner/admin status via is_write_accessible_to_user(),
|
AdminRequest: Option<bool>, // true when attaching from an org vault view
|
||||||
// so we can just ignore this field.
|
|
||||||
//
|
|
||||||
// AdminRequest: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum FileUploadType {
|
enum FileUploadType {
|
||||||
@ -821,14 +818,17 @@ fn post_attachment_v2(
|
|||||||
attachment.save(&conn).expect("Error saving attachment");
|
attachment.save(&conn).expect("Error saving attachment");
|
||||||
|
|
||||||
let url = format!("/ciphers/{}/attachment/{}", cipher.uuid, attachment_id);
|
let url = format!("/ciphers/{}/attachment/{}", cipher.uuid, attachment_id);
|
||||||
|
let response_key = match data.AdminRequest {
|
||||||
|
Some(b) if b => "CipherMiniResponse",
|
||||||
|
_ => "CipherResponse",
|
||||||
|
};
|
||||||
|
|
||||||
Ok(Json(json!({ // AttachmentUploadDataResponseModel
|
Ok(Json(json!({ // AttachmentUploadDataResponseModel
|
||||||
"Object": "attachment-fileUpload",
|
"Object": "attachment-fileUpload",
|
||||||
"AttachmentId": attachment_id,
|
"AttachmentId": attachment_id,
|
||||||
"Url": url,
|
"Url": url,
|
||||||
"FileUploadType": FileUploadType::Direct as i32,
|
"FileUploadType": FileUploadType::Direct as i32,
|
||||||
"CipherResponse": cipher.to_json(&headers.host, &headers.user.uuid, &conn),
|
response_key: cipher.to_json(&headers.host, &headers.user.uuid, &conn),
|
||||||
"CipherMiniResponse": null,
|
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user