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

[HOLD for payment 2023-01-20] Attachment - Drag and drop of application files throws wrong error message #13768

Closed
1 task
kavimuru opened this issue Dec 21, 2022 · 19 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff

Comments

@kavimuru
Copy link

kavimuru commented Dec 21, 2022

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Login with any account.
  2. Choose any report, choose an Application file (Steam, slack,
  3. Notice that the validation message says: "Attachment size must be greater than 240 bytes" even the size of attachment is 6MB.

Expected Result:

The attachment modal should show correct message.

Actual Result:

The attachment modal show incorrect message.

Workaround:

Move the validation fileExtension on to the top of isValidFile inside AttachmentModal

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • MacOS / Chrome and Win chrome

Version Number: 1.2.42-1
Reproducible in staging?: y
Reproducible in production?: y
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:

Screen.Recording.2022-12-20.at.11.53.12.mov
Recording.1134.mp4

Expensify/Expensify Issue URL:
Issue reported by: @hungvu193
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1671512078960629

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01aecef138c9bc6ea3
  • Upwork Job ID: 1612603999422697472
  • Last Price Increase: 2023-01-10
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 21, 2022
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Dec 21, 2022
@yuwenmemon yuwenmemon self-assigned this Jan 6, 2023
@melvin-bot melvin-bot bot added the Overdue label Jan 6, 2023
@yuwenmemon
Copy link
Contributor

Will take a look at this one.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jan 6, 2023
@muttmuure
Copy link
Contributor

Hm, I tried to replicate this and receive this message:

image

  1. Open staging.new.expensify.com
  2. Open chat with matt+1@miamimoore.com
  3. Click add attachment
  4. Select an application file (e.g. I chose Clipy).
  5. The error message is above

@melvin-bot melvin-bot bot removed the Overdue label Jan 9, 2023
@muttmuure
Copy link
Contributor

Are we sure this is replicable?

@yuwenmemon
Copy link
Contributor

@muttmuure Yeah, it's replicable when drag and dropping, not when using the attachment picker:

Kapture.2023-01-09.at.15.37.47.mp4

@yuwenmemon
Copy link
Contributor

yuwenmemon commented Jan 10, 2023

Although I think this is just related to the OS's file provided when dragging and dropping vs using the image picker, since both flows hit the same logic:

/**
* @param {Object} file
* @returns {Boolean}
*/
isValidFile(file) {
if (lodashGet(file, 'size', 0) > CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE) {
this.setState({
isAttachmentInvalid: true,
attachmentInvalidReasonTitle: this.props.translate('attachmentPicker.attachmentTooLarge'),
attachmentInvalidReason: this.props.translate('attachmentPicker.sizeExceeded'),
});
return false;
}
if (lodashGet(file, 'size', 0) < CONST.API_ATTACHMENT_VALIDATIONS.MIN_SIZE) {
this.setState({
isAttachmentInvalid: true,
attachmentInvalidReasonTitle: this.props.translate('attachmentPicker.attachmentTooSmall'),
attachmentInvalidReason: this.props.translate('attachmentPicker.sizeNotMet'),
});
return false;
}
const {fileExtension} = FileUtils.splitExtensionFromFileName(lodashGet(file, 'name', ''));
if (!_.contains(CONST.API_ATTACHMENT_VALIDATIONS.ALLOWED_EXTENSIONS, fileExtension.toLowerCase())) {
const invalidReason = `${this.props.translate('attachmentPicker.notAllowedExtension')} ${CONST.API_ATTACHMENT_VALIDATIONS.ALLOWED_EXTENSIONS.join(', ')}`;
this.setState({
isAttachmentInvalid: true,
attachmentInvalidReasonTitle: this.props.translate('attachmentPicker.wrongFileType'),
attachmentInvalidReason: invalidReason,
});
return false;
}
return true;
}

Here's what the get for the App file when using the file picker:
Screenshot 2023-01-09 at 4 10 36 PM

vs. Drag and Drop:
Screenshot 2023-01-09 at 4 10 56 PM

I think a simple solution would be just to check for file type first in this method, since that would give us some consistency when we can't control what receive from the OS/browser (unless we can?)

@yuwenmemon yuwenmemon added Hourly KSv2 Daily KSv2 Internal Requires API changes or must be handled by Expensify staff and removed Daily KSv2 Hourly KSv2 labels Jan 10, 2023
@melvin-bot melvin-bot bot unlocked this conversation Jan 10, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jan 10, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01aecef138c9bc6ea3

@melvin-bot
Copy link

melvin-bot bot commented Jan 10, 2023

Triggered auto assignment to Contributor Plus for review of internal employee PR - @Santhosh-Sellavel (Internal)

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jan 10, 2023
@melvin-bot melvin-bot bot changed the title Attachment - Drag and drop of application files throws wrong error message [HOLD for payment 2023-01-20] Attachment - Drag and drop of application files throws wrong error message Jan 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jan 13, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.53-0 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-01-20. 🎊

After the hold period, please check if any of the following need payment for this issue, and if so check them off after paying:

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Jan 13, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

@hungvu193
Copy link
Contributor

I have a question, if my solution (Posted in Workaround of this issue) is also the solution that contributor used to fix this bug, should I rewarded? @yuwenmemon 😂

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jan 19, 2023
@mallenexpensify mallenexpensify removed the Reviewing Has a PR in review label Jan 20, 2023
@mallenexpensify
Copy link
Contributor

@muttmuure can you issue payment and complete the regression test steps today? Also address @hungvu193 's question above. If needed, post in #contributor-plus to discuss, thanks.

@muttmuure
Copy link
Contributor

Will get to this today - I have a lot of other issues to get through but I will make sure this is done before I log off.

@muttmuure
Copy link
Contributor

OK getting to this now

@muttmuure
Copy link
Contributor

@muttmuure
Copy link
Contributor

I've invited @hungvu193 but @Santhosh-Sellavel isn't showing under our company hires

@muttmuure
Copy link
Contributor

Nevermind I've found him from another earlier job

@muttmuure
Copy link
Contributor

You're both invited to apply for the job. Thanks!

@Santhosh-Sellavel
Copy link
Collaborator

Applied for the job!

@melvin-bot melvin-bot bot added the Overdue label Jan 23, 2023
@muttmuure
Copy link
Contributor

Everyone is paid. Great hustle everybody.

@melvin-bot melvin-bot bot removed the Overdue label Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests

6 participants