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.56k stars 2.9k forks source link

[$250] iOS - Attachment - App crashes when editing comment with video #46114

Closed lanitochka17 closed 2 months ago

lanitochka17 commented 3 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.11-2 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Issue reported by: Applause - Internal Team

Action Performed:

  1. Launch New Expensify app
  2. Go to DM
  3. Type any message (do not send it)
  4. Tap + > Add attachment
  5. Select a video
  6. Send the video
  7. Long press on the message with text and video
  8. Tap Edit comment

Expected Result:

App will not crash

Actual Result:

App crashes on iOS app Console error shows up on web app

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/6f95d7bd-c746-4c82-8e1f-6de594d7920f

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e2f80c595cce99e8
  • Upwork Job ID: 1816209661264574315
  • Last Price Increase: 2024-07-24
  • Automatic offers:
    • ZhenjaHorbach | Reviewer | 103271953
    • nkdengineer | Contributor | 103271954
Issue OwnerCurrent Issue Owner: @ZhenjaHorbach
melvin-bot[bot] commented 3 months ago

Triggered auto assignment to @slafortune (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 3 months ago

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

lanitochka17 commented 3 months ago

@slafortune 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

melvin-bot[bot] commented 3 months ago

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

melvin-bot[bot] commented 3 months ago

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

nkdengineer commented 3 months ago

Proposal

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

App crashes on iOS app Console error shows up on web app

What is the root cause of that problem?

In https://github.com/Expensify/react-native-live-markdown/blob/ff55579f673c049a6eb6cdf38ffc223315309b07/parser/index.ts#L194, we don't have code to parseTreeToTextAndRanges for video tag yet. So it throws error here

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

Add code to parseTreeToTextAndRanges for video tag here, it's quite similar to img tag.

Pseudocode for it:

else if (node.tag.startsWith('<video data-expensify-source="')) {
    const src = node.tag.match(/data-expensify-source="([^"]*)"/)![1]!; // always present
    const rawLink = node.tag.match(/data-raw-href="([^"]*)"/);
    const linkString = rawLink ? Utils.unescapeText(rawLink[1]!) : src;
    const attachmentName = node.children?.join('')?.replaceAll('&#32;', ' ');

    appendSyntax('!');
    if (attachmentName) {
      appendSyntax('[');
      processChildren(Utils.unescapeText(attachmentName || ''));
      appendSyntax(']');
    }
    appendSyntax('(');
    addChildrenWithStyle(linkString, 'link');
    appendSyntax(')');
  }

What alternative solutions did you explore? (Optional)

ZhenjaHorbach commented 3 months ago

As additional information:

Снимок экрана 2024-07-25 в 09 52 44

ZhenjaHorbach commented 3 months ago

@nkdengineer Thank you for your proposal ! Your proposal makes sense to me And I agree that we need to add a new condition for parseTreeToTextAndRanges for video tags

🎀👀🎀 C+ reviewed

melvin-bot[bot] commented 3 months ago

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

MariaHCD commented 3 months ago

I am going OOO so I won't be able to see this through completion. @slafortune could you reassign an internal engineer here?

MariaHCD commented 3 months ago

Actually, @mountiny is willing to take over for me! Thanks!

melvin-bot[bot] commented 3 months ago

📣 @ZhenjaHorbach 🎉 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

📣 @nkdengineer 🎉 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 📖

mountiny commented 3 months ago

cc @tomekzaw @BartoszGrajdek for visibility

nkdengineer commented 3 months ago

@ZhenjaHorbach @mountiny this PR is ready for review

nkdengineer commented 3 months ago

This PR is merged. I'll create PR to bump new version soon

melvin-bot[bot] commented 3 months ago

@slafortune, @mountiny, @ZhenjaHorbach, @nkdengineer Huh... This is 4 days overdue. Who can take care of this?

ZhenjaHorbach commented 3 months ago

Not overdue PR in progress

nkdengineer commented 3 months ago

@ZhenjaHorbach The PR is here.

slafortune commented 3 months ago

This is being worked on, it will have a 7-day regression period, so I don't feel the need to add another BZ person to this. I'll be out until 8/21 and will check in on this then.

ZhenjaHorbach commented 2 months ago

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:

  • [x] [@ZhenjaHorbach] The PR that introduced the bug has been identified. Link to the PR:

Unfortunately, I did not find a suitable PR

  • [x] [@ZhenjaHorbach] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:

NA

  • [x] [@ZhenjaHorbach] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:

NA

  • [x] [@ZhenjaHorbach] Determine if we should create a regression test for this bug.
  • [x] [@ZhenjaHorbach] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

Regression Test Proposal

  1. Open App
  2. Open any report
  3. Send a video with text
  4. Open the context menu --> edit the comment
  5. Verify that the edit composer appears without crashes (IOS Native and Android Native) or errors in the JS console (Web and Desktop)

    Do we agree 👍 or 👎

ZhenjaHorbach commented 2 months ago

Following this comment PR was deployed to prod August 13 So everything is ready for payment !

slafortune commented 2 months ago

@ZhenjaHorbach and @nkdengineer - both paid via UpWorks as the C+ and Contributor roles.