Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.58k stars 2.92k forks source link

[Awaiting Payment][$250] Attachment - A broken video file is loaded via action menu #46343

Closed lanitochka17 closed 2 months ago

lanitochka17 commented 4 months ago

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


Version Number: 9.0.13-1 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4771740 Email or phone of affected tester (no customers): sustinov@applausemail.com Issue reported by: Applause - Internal Team

Action Performed:

  1. Open https://staging.new.expensify.com/.
  2. Log in with any account
  3. Navigate to any conversation or create one
  4. Send any video to the conversation
  5. Wait for the video to upload
  6. Open the action menu on the message containing the video
  7. Click Download

Expected Result:

Using the action menu, the video file should be downloaded uncorrupted

Actual Result:

A corrupted video file is loaded via the action menu

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/ba07d5dc-cb03-4f8a-92e6-040076a2dcc7

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~011ea5f33ec2b35a17
  • Upwork Job ID: 1818205757531703482
  • Last Price Increase: 2024-07-30
  • Automatic offers:
    • alitoshmatov | Reviewer | 103356880
    • Krishna2323 | Contributor | 103356881
Issue OwnerCurrent Issue Owner: @kadiealexander
melvin-bot[bot] commented 4 months ago

Triggered auto assignment to @kadiealexander (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

lanitochka17 commented 4 months ago

We think that this bug might be related to #vip-vsp

lanitochka17 commented 4 months ago

@kadiealexander FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

neonbhai commented 4 months ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

Attachment - A broken video file is loaded via action menu

What is the root cause of that problem?

The root cause is we lose the correct file name here:

https://github.com/Expensify/App/blob/9901ca3a554f4c2991b56862dfb8e43d2e1aba80/src/libs/fileDownload/DownloadUtils.ts#L60

This happens as when fileName is empty string, ?? operator is not triggered,

What changes do you think we should make in order to solve the problem?

We will use || operator to make sure FileUtils.getFileName(url) is called.

const completeFileName = FileUtils.appendTimeToFileName(fileName || FileUtils.getFileName(url));

Alternatively

We may use another variable to calculate param.

Result

This works perfectly

https://github.com/user-attachments/assets/25c6b1de-853b-43b0-982c-fd002266c09a

Krishna2323 commented 4 months ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

Attachment - A broken video file is loaded via action menu

What is the root cause of that problem?

What changes do you think we should make in order to solve the problem?

We need to modify the regex to also consider for video tags.

new RegExp('<(?:a|video)[^>]*>([^<]+)</(?:a|video)>', 'i');

What alternative solutions did you explore? (Optional)

Result

https://github.com/user-attachments/assets/19223227-5961-48f8-be4b-0d08745f82e0

melvin-bot[bot] commented 3 months ago

Job added to Upwork: https://www.upwork.com/jobs/~011ea5f33ec2b35a17

melvin-bot[bot] commented 3 months ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @alitoshmatov (External)

alitoshmatov commented 3 months ago

@neonbhai Thank you for your proposal, your RCA is correct but the main problem here is fileName being empty where it shouldn't. We should fix this rather than adjusting our code to work with this issue

alitoshmatov commented 3 months ago

@Krishna2323 Thank you for your proposal, your RCA is correct and your solution does solve the issue of fileName being empty.

We can go with @Krishna2323 's proposal

C+ reviewed πŸŽ€ πŸ‘€ πŸŽ€

melvin-bot[bot] commented 3 months ago

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

melvin-bot[bot] commented 3 months ago

πŸ“£ @alitoshmatov πŸŽ‰ An offer has been automatically sent to your Upwork account for the Reviewer role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job

melvin-bot[bot] commented 3 months ago

πŸ“£ @Krishna2323 πŸŽ‰ An offer has been automatically sent to your Upwork account for the Contributor role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review πŸ§‘β€πŸ’» Keep in mind: Code of Conduct | Contributing πŸ“–

Krishna2323 commented 3 months ago

@alitoshmatov, PR ready for review ^

Krishna2323 commented 3 months ago

@alitoshmatov, friendly bump for PR review.

danieldoglas commented 3 months ago

I think this was deployed to production yesterday. So now we have a regression period of 7 days. cc @kadiealexander

Krishna2323 commented 3 months ago

@kadiealexander, this is ready for payments as per the comment above.

melvin-bot[bot] commented 3 months ago

This issue has not been updated in over 15 days. @danieldoglas, @kadiealexander, @alitoshmatov, @Krishna2323 eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

Krishna2323 commented 2 months ago

@kadiealexander, friendly bump for payments.

alitoshmatov commented 2 months ago

Waiting for payment, PR was deployed on 14th of august

Krishna2323 commented 2 months ago

@kadiealexander, friendly bump for payments :)

danieldoglas commented 2 months ago

added the correct labels and assigned @kadiealexander to be the main person responsible for this issue.

kadiealexander commented 2 months ago

Payouts due:

Upwork job is here.