Skip to content
This repository was archived by the owner on Jun 17, 2022. It is now read-only.

Upload Directly to Azure or Local storage#285

Closed
MGibson1 wants to merge 4 commits intomasterfrom
direct-upload-and-download-of-send-files
Closed

Upload Directly to Azure or Local storage#285
MGibson1 wants to merge 4 commits intomasterfrom
direct-upload-and-download-of-send-files

Conversation

@MGibson1
Copy link
Member

@MGibson1 MGibson1 commented Feb 26, 2021

Overview

Companion PR to bitwarden/server#1167 and bitwarden/web#853
Receives Send file upload and download URLs from Server to directly upload to a specified endpoint. This allows for directly uploading to Azure.

Files Changed

  • package.json/package-lock.json: Included azure/storage-blob to handle upload to an azure url
  • api.service.ts: Separates Api tasks from posting a Send that is of type file to Posting a send without data, receiving Identifiers and upload URLs and a post endpoint to allow for direct upload to a local storage service (PostSendFile). Also creates a GetDownloadURL method that returns the appropriate URL to download a blob/file from.
  • FileUploadType: Enum defining the way to upload a file. Direct upload to Bitwarden requires encapsulating in FormData, Blob upload is handled by Azure code.
  • SendFileApi/SendFileData/SendFile/SendFileView: these models no longer contain a download URL since we can require calling the getSendFileDownloadData endpoint.
  • SendRequest: Now includes a trust-based hint on the file size we will be uploading. Required and checked only for File type sends. This file size hint is verified post file upload and the send is deleted if it is incorrect within 1MB.
  • SendFileDownloadDataResponse: Download information. Useful bit is the URL to fetch from
  • SendFileUploadDataResponse: Upload information. Holds:
    1. The generated Send as a SendResponse
    2. The URL to upload a file to
    3. The type of upload required (see FileUploadType)
  • SendService: Implement the above changes. Direct uploads use form data and upload only the file content. Azure code handles blob upload. SendRequest is popuplated with a file size.

@MGibson1 MGibson1 force-pushed the direct-upload-and-download-of-send-files branch from 2fe1caa to 759cb40 Compare February 26, 2021 16:03
@MGibson1 MGibson1 requested a review from cscharf February 26, 2021 17:38
cscharf
cscharf previously approved these changes Feb 26, 2021
Copy link
Contributor

@cscharf cscharf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, although I would caution merging it before the server changes are ready and merged.

@MGibson1 MGibson1 mentioned this pull request Mar 1, 2021
@MGibson1
Copy link
Member Author

Closing due to split into #288 & #296

@MGibson1 MGibson1 closed this Mar 11, 2021
@cscharf cscharf deleted the direct-upload-and-download-of-send-files branch April 22, 2021 13:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants