Skip to content

Forms : Attachment size based functionality restrictions #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

kaushikrw
Copy link
Collaborator

@kaushikrw kaushikrw commented Jul 17, 2024

Related to issue: #apollo/775, #apollo/768

Description:

Restricts rename/delete for empty attachment. This is because rename/delete on an 0 sized attachment will result in error when applyEdits() is called.
Blocks download and rename of large attachments of > 50 MB. This is because renaming an attachment will load the attachment into memory which we are trying to avoid

Summary of changes:

  • The context menu is hidden for any attachments whose size is 0.
  • FormAttachmentState.maxAttachmentSize specifies the max allowed attachment size that can be loaded. This is 50 MB currently.
  • Added two exception types that can be used to send error information to the UI from the FormAttachmentState.
    • AttachmentSizeLimitExceededException - indicates attachment size exceeds the maximum limit.
    • EmptyAttachmentException - indicates attachment size is 0.
  • AttachmentTile can now collect on the FormAttachmentState.loadStatus to listen to failures and display a toast accordingly.
  • Rename is disabled in the context menu for attachments greater than the specified limit in FormAttachmentState.maxAttachmentSize

Pre-merge Checklist

  • a vTest Job for this PR has been run
    • link:
  • Unit and/or integration tests have been added to exercise this PR's logic, and the tests are passing:
    • Yes
    • No

@kaushikrw kaushikrw self-assigned this Jul 17, 2024
@kaushikrw kaushikrw marked this pull request as ready for review July 17, 2024 18:25
@kaushikrw kaushikrw requested a review from sorenoid July 17, 2024 18:25
@kaushikrw kaushikrw merged commit 7cc63c1 into feature-branches/forms Jul 18, 2024
@kaushikrw kaushikrw deleted the kaushik/forms/block-empty-large-attachments branch July 18, 2024 18:27
kaushikrw added a commit that referenced this pull request Jul 18, 2024
* added horizontal scrollbar (#473)

* `Forms` : Add attachment tests (#480)

* `Forms` : Refactor tests (#488)

* Update CorePrototypes.kt (#494)

* `Forms` : handle empty attachments (#498)

* restrict download and viewing attachments of 0 size

* show error along with load

* ignore non-default formattachmentelement (#499)

* `Forms` : Fix strings (#500)

* `Forms` : Micro-app update oauth credentials (#507)

* refactor generating new attachment names (#505)

* `Form` : Attachment theming (#490)

* `Forms` : Consume latest api (#506)

* make thumbnails part of the state object (#514)

* add attachment size restrictions for loading (#518)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants