Skip to content
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

Don't allow upload of large attachments [hold for payment on August 5th] #3926

Closed
rushatgabhane opened this issue Jul 8, 2021 · 24 comments
Closed
Assignees
Labels
Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Improvement Item broken or needs improvement.

Comments

@rushatgabhane
Copy link
Member

rushatgabhane commented Jul 8, 2021

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


I'm assuming API allows max attachment size of 100 MB. Please correct me if I'm wrong.

Action Performed:

  1. Login to E.cash
  2. Click add attachment.
  3. Select a file larger than 100 MB, and send it.

Expected Result:

Should display a message like "Attachment is larger than 100 MB"
and not allow upload of the attachment.

Actual Result:

The attachment is allowed to upload even though the API doesn't allow uploads larger than 100 MB.
And a forever spinner gets displayed.

Workaround:

N.A.

Platform:

Where is this issue occurring?

Web ✔️
iOS ✔️
Android ✔️
Desktop App ✔️
Mobile Web ✔️

Version Number:
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:

View all open jobs on Upwork

@rushatgabhane rushatgabhane added the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Jul 8, 2021
@MelvinBot
Copy link

Triggered auto assignment to @bfitzexpensify (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

@MelvinBot MelvinBot removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Jul 8, 2021
@rushatgabhane
Copy link
Member Author

rushatgabhane commented Jul 8, 2021

Proposal

In components/AttachmentModal

For attachments larger than 100 MB,
show the message "Attachment is larger than 100 MB limit", and disable the send button.

English and Spanish message will be added, and size limit will be set in CONST.js

@MelvinBot
Copy link

Triggered auto assignment to @yuwenmemon (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@bfitzexpensify bfitzexpensify removed their assignment Jul 26, 2021
@yuwenmemon yuwenmemon added the Improvement Item broken or needs improvement. label Jul 26, 2021
@yuwenmemon
Copy link
Contributor

I'm curious how we picture this error message to show? I don't think we should even render the preview and disable the upload button here. Since a large file would probably be cumbersome to render anyway:
Screen Shot 2021-07-26 at 2 27 35 PM

We should probably just flash a separate, solo error message

@yuwenmemon
Copy link
Contributor

Code where this happens:

onChange={(e) => {
const file = e.target.files[0];
if (file) {
file.uri = URL.createObjectURL(file);
this.onPicked(file);
}
// Cleanup after selecting a file to start from a fresh state
this.fileInput.value = null;

@yuwenmemon
Copy link
Contributor

Spanish translation: El documento adjunto supera el límite de 100 MB

@quinthar
Copy link
Contributor

quinthar commented Jul 26, 2021 via email

@rushatgabhane
Copy link
Member Author

rushatgabhane commented Jul 26, 2021

Yeah, gonna conditionally render text vs preview.
This is similiar to how whatsapp web handles it.

@yuwenmemon yuwenmemon added Weekly KSv2 AutoAssignerTriage Auto assign issues for triage to an available triage team member and removed Daily KSv2 labels Jul 26, 2021
@MelvinBot
Copy link

Triggered auto assignment to @muttmuure (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

@MelvinBot MelvinBot removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Jul 26, 2021
@yuwenmemon yuwenmemon added the External Added to denote the issue can be worked on by a contributor label Jul 26, 2021
@MelvinBot
Copy link

Triggered auto assignment to @kadiealexander (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@MelvinBot MelvinBot added Daily KSv2 and removed Weekly KSv2 labels Jul 26, 2021
@yuwenmemon
Copy link
Contributor

Hmmm... @rushatgabhane what if you use the ConfirmModal instead? What would that look like?
https://github.com/Expensify/App/blob/main/src/components/ConfirmModal.js

@rushatgabhane
Copy link
Member Author

rushatgabhane commented Jul 27, 2021

@yuwenmemon yeah, it looks better! And we don't have to deal with the download attachment button.

I'll fine tune the title and promt text in the PR.

image

@quinthar
Copy link
Contributor

quinthar commented Jul 27, 2021 via email

@yuwenmemon
Copy link
Contributor

@rushatgabhane quick edit on the Spanish text, it's actually: El archivo adjunto supera el límite de 100 MB

@yuwenmemon
Copy link
Contributor

What is our actual limit? I'm assuming a lot smaller than that.

Yeah, @rushatgabhane based on Expensify's internal ReceiptAPI the limit is actually 50MB:

/**
 * Class ReceiptAPI.
 *
 * Wrapper for API receipt calls
 */
class ReceiptAPI
{
    use LogTrait;

    // 50 megabytes in bytes
    const SIZE_LIMIT = 52428800;

@kadiealexander
Copy link
Contributor

Wow, this moved quickly! Upwork post here: https://www.upwork.com/jobs/~013cc27ddfb15c57a3

@MelvinBot MelvinBot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 29, 2021
@MelvinBot
Copy link

Triggered auto assignment to @NikkiWines (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@kadiealexander kadiealexander removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 29, 2021
@yuwenmemon
Copy link
Contributor

yuwenmemon commented Jul 29, 2021

I believe @rushatgabhane is working on this? (And it was already merged?)

@kadiealexander
Copy link
Contributor

Yeah, it moved really quickly. Was just getting the Upwork post up to arrange payment for @rushatgabhane :)

@rushatgabhane
Copy link
Member Author

I believe @rushatgabhane is working on this? (And it was already merged?)

Yes :)

@kadiealexander
Copy link
Contributor

Issue #4356 must be resolved.

@rushatgabhane
Copy link
Member Author

@kadiealexander resolved and closed!

@kadiealexander
Copy link
Contributor

Thanks @rushatgabhane! The original PR was merged 5 days ago, so will process payment in 2 more days. :)

@kadiealexander kadiealexander changed the title Don't allow upload of large attachments. Don't allow upload of large attachments [hold for payment on August 5th] Aug 3, 2021
@kadiealexander
Copy link
Contributor

Paid with a bonus for finding the issue! Thanks @rushatgabhane 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Improvement Item broken or needs improvement.
Projects
None yet
Development

No branches or pull requests

9 participants