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 2024-08-26] [$250] iOS - Chat - App crashes when adding a space at the end of hyperlink text while editing #45623

Closed
1 of 6 tasks
lanitochka17 opened this issue Jul 17, 2024 · 53 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 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 17, 2024

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


Version Number: 9.0.8-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/4732111
**Issue reported by:**Applause - Internal Team

Action Performed:

  1. Log in to New Expensify
  2. Navigate to any chat
  3. Send message with any hyperlink, e.g. link.com
  4. Edit the message
  5. Try to add space at the end of link.com text part of hyperlink

Expected Result:

Space should be appended at the end of hyperlink text

Actual Result:

The app crashes

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6545344_1721230676639.NVXM4738.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01765448d1b685d840
  • Upwork Job ID: 1813943785653464004
  • Last Price Increase: 2024-07-25
  • Automatic offers:
    • DylanDylann | Contributor | 103339219
    • dominictb | Contributor | 103353044
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @twisterdotcom
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 17, 2024
Copy link

melvin-bot bot commented Jul 17, 2024

Triggered auto assignment to @twisterdotcom (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
Copy link
Author

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

@lanitochka17
Copy link
Author

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

@twisterdotcom
Copy link
Contributor

Is odd. Going to put this in live markdown though.

@twisterdotcom twisterdotcom added the External Added to denote the issue can be worked on by a contributor label Jul 18, 2024
@melvin-bot melvin-bot bot changed the title iOS - Chat - App crashes when adding a space at the end of hyperlink text while editing [$250] iOS - Chat - App crashes when adding a space at the end of hyperlink text while editing Jul 18, 2024
Copy link

melvin-bot bot commented Jul 18, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01765448d1b685d840

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 18, 2024
Copy link

melvin-bot bot commented Jul 18, 2024

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

@twisterdotcom twisterdotcom added Weekly KSv2 and removed Daily KSv2 labels Jul 18, 2024
@allgandalf
Copy link
Contributor

Ouch that was bad, @lanitochka17 does it not happen on android ?

@twisterdotcom
Copy link
Contributor

No, on Android it isn't an issue, although it never saves the extra space.

@allgandalf
Copy link
Contributor

can you put this to daily @twisterdotcom , crashes are really bad, was there a reason for weekly?

@twisterdotcom
Copy link
Contributor

The reason I made it weekly is that it's a very niche flow. We can make it daily, but I don't think it will necessarily help it get done quicker.

@twisterdotcom twisterdotcom added Daily KSv2 and removed Weekly KSv2 labels Jul 23, 2024
@dominictb
Copy link
Contributor

dominictb commented Jul 24, 2024

Proposal

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

iOS - Chat - App crashes when adding a space at the end of hyperlink text while editing

What is the root cause of that problem?

In here, we are trimming spaces from both end, so in here, the final converted text will be different from the input markdown, and this will trigger a console.error here.

However, in iOS, we are using bare Hermes runtime (check this) to evaluate the parser script. Unfortunately, according to facebook/hermes#675, the 'console' is not available in the bare Hermes runtime, hence the crash.

To reproduce, we can run the example iOS app in the react-native-live-markdown and follow the OP's step. We can see in the XCode console that the error is something like 'console' property is not defined - JSI evaluation....

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

Simplest solution is to remove console.error here. But if we want to raise the error in the console screen or capture this for investigation purpose, we can try to polyfill the console object, so in case console is undefined, we will do nothing

In here, add

const globalConsole = (globalThis.console ?? null) as Console | null

....
catch (error) {
    globalConsole?.error?.(error);
    // returning an empty array in case of error
    return [];
}

Additionally, we also need to allow trailing spaces on link name. This can be done by following code change in these 2 functions here.

replacement: (_extras, match, g1, g2) => {
    if (!g1.trim()) {
        return match;
    }
    return `<a href="${str_1.default.sanitizeURL(g2)}" target="_blank" rel="noreferrer noopener">${g1}</a>`;
},
rawInputReplacement: (_extras, match, g1, g2) => {
    if (!g1.trim()) {
        return match;
    }
    return `<a href="${str_1.default.sanitizeURL(g2)}" data-raw-href="${g2}" data-link-variant="labeled" target="_blank" 
   rel="noreferrer noopener">${g1}</a>`;
},

We can further extend by only allowing extra trailing spaces in link markdown parsing in react-native-live-markdown's parser by using the extras object from ExpensiMark, just in case we don't want trailing spaces when sending the markdown/html string to the BE.

What alternative solutions did you explore? (Optional)

We can utilize https://www.npmjs.com/package/babel-plugin-transform-globals to replace the console.error or console.log usage, so we can avoid weird implementation as in the main suggested solution.

Copy link

melvin-bot bot commented Jul 25, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Jul 25, 2024
@allgandalf
Copy link
Contributor

I will review the above proposal by EOD

@melvin-bot melvin-bot bot removed the Overdue label Jul 26, 2024
Copy link

melvin-bot bot commented Jul 29, 2024

@twisterdotcom, @allgandalf Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Jul 29, 2024
@allgandalf
Copy link
Contributor

Sorry, this fell through the cracks, i will review the proposal today

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Aug 11, 2024
@muttmuure muttmuure added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Aug 15, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 15, 2024
Copy link

melvin-bot bot commented Aug 15, 2024

Current assignee @DylanDylann is eligible for the External assigner, not assigning anyone new.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Aug 15, 2024
@muttmuure muttmuure removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 15, 2024
@muttmuure
Copy link
Contributor

muttmuure commented Aug 15, 2024

I can't get the auto-assigner to kick in, but I've pinged @mountiny to see if he can merge the PR above

@dominictb
Copy link
Contributor

This should be ready for payment, no?

@twisterdotcom
Copy link
Contributor

Is this for #47199 (comment)? This was deployed to prod 2 days ago, so we should add [Hold for payment 2024-08-26] right?

Copy link

melvin-bot bot commented Aug 22, 2024

@twisterdotcom, @Gonals, @mountiny, @DylanDylann, @dominictb Whoops! This issue is 2 days overdue. Let's get this updated quick!

@twisterdotcom twisterdotcom changed the title [$250] iOS - Chat - App crashes when adding a space at the end of hyperlink text while editing [Hold for payment 2024-08-26] [$250] iOS - Chat - App crashes when adding a space at the end of hyperlink text while editing Aug 22, 2024
@twisterdotcom twisterdotcom added the Awaiting Payment Auto-added when associated PR is deployed to production label Aug 22, 2024
Copy link

melvin-bot bot commented Aug 26, 2024

@twisterdotcom, @Gonals, @mountiny, @DylanDylann, @dominictb 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@twisterdotcom
Copy link
Contributor

I am OOO and will be back for payment on Thurs.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Daily KSv2 labels Aug 29, 2024
Copy link

melvin-bot bot commented Sep 6, 2024

@twisterdotcom, @Gonals, @mountiny, @DylanDylann, @dominictb Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@DylanDylann
Copy link
Contributor

@twisterdotcom Kindly bump on payment

Copy link

melvin-bot bot commented Sep 10, 2024

@twisterdotcom, @Gonals, @mountiny, @DylanDylann, @dominictb Still overdue 6 days?! Let's take care of this!

@twisterdotcom twisterdotcom removed the Reviewing Has a PR in review label Sep 10, 2024
@melvin-bot melvin-bot bot added the Overdue label Sep 10, 2024
@twisterdotcom
Copy link
Contributor

Sorry this slipped through the cracks. Payment Summary:

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 External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests

9 participants