[PR #1345] [MERGED] Attachment azure upload blobs #2844

Closed
opened 2025-11-26 23:24:53 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1345
Author: @MGibson1
Created: 3/30/2021
Status: Merged
Merged: 3/30/2021
Merged by: @MGibson1

Base: masterHead: attachment-azure-upload-blobs


📝 Commits (6)

  • 05c1767 Update Size limits
  • fee2d14 Add new Api paths for direct upload of Cipher Attachments
  • 86bd92f Add Attachment upload to fileUploadService
  • ca07d21 Save with direct upload and fallback to legacy uplaod
  • 429fc2c Inform on when to remove legacy code
  • 2b61f8e Test Attachment upload

📊 Changes

15 files changed (+292 additions, -25 deletions)

View changed files

📝 src/App/Pages/Send/SendAddEditPage.xaml (+1 -1)
📝 src/App/Pages/Vault/AttachmentsPageViewModel.cs (+1 -1)
📝 src/App/Pages/Vault/ViewPageViewModel.cs (+1 -1)
📝 src/App/Resources/AppResources.resx (+0 -3)
📝 src/Core/Abstractions/IApiService.cs (+6 -1)
📝 src/Core/Abstractions/ICipherService.cs (+1 -1)
📝 src/Core/Abstractions/IFileUploadService.cs (+1 -0)
📝 src/Core/Models/Request/AttachmentRequest.cs (+1 -0)
src/Core/Models/Response/AttachmentUploadDataReponse.cs (+12 -0)
📝 src/Core/Services/ApiService.cs (+26 -3)
📝 src/Core/Services/CipherService.cs (+52 -11)
📝 src/Core/Services/FileUploadService.cs (+31 -2)
📝 src/Core/Utilities/ServiceContainer.cs (+1 -1)
test/Core.Test/AutoFixture/Cipher/CipherCustomizations.cs (+62 -0)
test/Core.Test/Services/CipherServiceTests.cs (+96 -0)

📄 Description

Overview

Commensurate PR with bitwarden/jslib#312.

Add the ability to direct upload to Azure or Bitwarden for cipher attachments. Increases size limit to 500MB.

Files Changed

  • SendAddEditPage/AttachmentPageView/AppResources: Update max upload size to 500MB for both Send and Attachments.
  • ViewPageViewModel: Cipher ID is needed for new download url request.
  • ApiService: Direct upload endpoints for attachments. Similar to those for Send
    • PostCipherAttachmentLegacy: The old attachment upload method
    • PostCipherAttachmentAsync: New cipher attachment endpoint. Responds with instructions on how to upload the attachment file.
    • PostCipherAttachment/RenewAttachmentUploadUrl: The same path. returns a new upload URL and information on how to upload
    • PostAttachmentFileAsync: Direct upload to Bitwarden for self-hosted storage solutions.
  • FileUploadService: Upload methods for Attachments. Similar to Sends.
  • AttachmentRequest: Include file size as a promise to upload a file of the given size. File sizes are validated post upload.
  • AttachmentUploadDataResponse: Cipher and associated attachment upload information.
  • CipherService: Upload first with the new methods and fallback to old. Same with downloading of attachments.
  • ServiceContainer.cs: New dependencies on CipherService.
  • Test Changes: unit tests are in place to verify fallback behavior.

Testing

Similar to bitwarden/jslib#312, we need to test this using all combinations of new/old client new/old server. Code exists in both locations to fall back to legacy upload means.

Note: if the server is legacy, upload sizes will be limited to 100MB rather than 500. This is because there are server-side checks in place that cannot be overridden by the client. We could request max upload size from the Server, but we don't currently do that.

Critical sizes of attachments are:

  • < 256 MB
  • 256 MB but less than 500 MB

  • 500 MB (expect failure)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/1345 **Author:** [@MGibson1](https://github.com/MGibson1) **Created:** 3/30/2021 **Status:** ✅ Merged **Merged:** 3/30/2021 **Merged by:** [@MGibson1](https://github.com/MGibson1) **Base:** `master` ← **Head:** `attachment-azure-upload-blobs` --- ### 📝 Commits (6) - [`05c1767`](https://github.com/bitwarden/android/commit/05c17675d2fd84ffea26d9c100353c9b5534c379) Update Size limits - [`fee2d14`](https://github.com/bitwarden/android/commit/fee2d14f0afd798d3e13d011fb339ebb5e28e121) Add new Api paths for direct upload of Cipher Attachments - [`86bd92f`](https://github.com/bitwarden/android/commit/86bd92fadc568c103677ca4a51e28babb2734cf1) Add Attachment upload to fileUploadService - [`ca07d21`](https://github.com/bitwarden/android/commit/ca07d21a817254deba02ddcf61ca422822b84e98) Save with direct upload and fallback to legacy uplaod - [`429fc2c`](https://github.com/bitwarden/android/commit/429fc2cffb9c764be699fd8579a1931448912425) Inform on when to remove legacy code - [`2b61f8e`](https://github.com/bitwarden/android/commit/2b61f8e986486cec176994dd66cfc7a2d5405451) Test Attachment upload ### 📊 Changes **15 files changed** (+292 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `src/App/Pages/Send/SendAddEditPage.xaml` (+1 -1) 📝 `src/App/Pages/Vault/AttachmentsPageViewModel.cs` (+1 -1) 📝 `src/App/Pages/Vault/ViewPageViewModel.cs` (+1 -1) 📝 `src/App/Resources/AppResources.resx` (+0 -3) 📝 `src/Core/Abstractions/IApiService.cs` (+6 -1) 📝 `src/Core/Abstractions/ICipherService.cs` (+1 -1) 📝 `src/Core/Abstractions/IFileUploadService.cs` (+1 -0) 📝 `src/Core/Models/Request/AttachmentRequest.cs` (+1 -0) ➕ `src/Core/Models/Response/AttachmentUploadDataReponse.cs` (+12 -0) 📝 `src/Core/Services/ApiService.cs` (+26 -3) 📝 `src/Core/Services/CipherService.cs` (+52 -11) 📝 `src/Core/Services/FileUploadService.cs` (+31 -2) 📝 `src/Core/Utilities/ServiceContainer.cs` (+1 -1) ➕ `test/Core.Test/AutoFixture/Cipher/CipherCustomizations.cs` (+62 -0) ➕ `test/Core.Test/Services/CipherServiceTests.cs` (+96 -0) </details> ### 📄 Description # Overview Commensurate PR with bitwarden/jslib#312. Add the ability to direct upload to Azure or Bitwarden for cipher attachments. Increases size limit to 500MB. # Files Changed * **SendAddEditPage/AttachmentPageView/AppResources**: Update max upload size to 500MB for both Send and Attachments. * **ViewPageViewModel**: Cipher ID is needed for new download url request. * **ApiService**: Direct upload endpoints for attachments. Similar to those for Send * PostCipherAttachmentLegacy: The old attachment upload method * PostCipherAttachmentAsync: New cipher attachment endpoint. Responds with instructions on how to upload the attachment file. * PostCipherAttachment/RenewAttachmentUploadUrl: The same path. returns a new upload URL and information on how to upload * PostAttachmentFileAsync: Direct upload to Bitwarden for self-hosted storage solutions. * **FileUploadService**: Upload methods for Attachments. Similar to Sends. * **AttachmentRequest**: Include file size as a promise to upload a file of the given size. File sizes are validated post upload. * **AttachmentUploadDataResponse**: Cipher and associated attachment upload information. * **CipherService**: Upload first with the new methods and fallback to old. Same with downloading of attachments. * **ServiceContainer.cs**: New dependencies on CipherService. * **Test Changes**: unit tests are in place to verify fallback behavior. # Testing Similar to bitwarden/jslib#312, we need to test this using all combinations of new/old client new/old server. Code exists in both locations to fall back to legacy upload means. > Note: if the server is legacy, upload sizes will be limited to 100MB rather than 500. This is because there are server-side checks in place that cannot be overridden by the client. We _could_ request max upload size from the Server, but we don't currently do that. Critical sizes of attachments are: * < 256 MB * > 256 MB but less than 500 MB * > 500 MB (expect failure) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-26 23:24:53 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#2844