Add support for v2 attachment upload APIs

Upstream PR: https://github.com/bitwarden/server/pull/1229
This commit is contained in:
Jeremy Lin
2021-05-25 03:48:57 -07:00
parent 7d5186e40a
commit 29ed82a359
4 changed files with 200 additions and 34 deletions

View File

@ -173,7 +173,7 @@ fn post_send_file(data: Data, content_type: &ContentType, headers: Headers, conn
// Create the Send
let mut send = create_send(data.data, headers.user.uuid.clone())?;
let file_id: String = data_encoding::HEXLOWER.encode(&crate::crypto::get_random(vec![0; 32]));
let file_id = crate::crypto::generate_file_id();
if send.atype != SendType::File as i32 {
err!("Send content is not a file");