Skip to content

[$250] Incorrect parsing for backticks with a space in between them #48101

Closed

Description

@dangrous

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:
Reproducible in staging?: yes
Reproducible in production?: yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by:
Slack conversation: not Slack but #46917 (comment)

Action Performed:

  1. Send the following input:
it uses`;`separated fields because the line number column could have`:`in them ` ` with space

Expected Result:

The input should look like

it uses;separated fields because the line number column could have:in them with space

(The space at the end is in a code block)

Actual Result:

The input looks like

image

(The space at the end is not in a code block, the backticks are visible)

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Yes

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

See above.

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e928bacaaf9c0339
  • Upwork Job ID: 1831034909462647027
  • Last Price Increase: 2024-09-03
  • Automatic offers:
    • hoangzinh | Reviewer | 103821976
    • tsa321 | Contributor | 103821978
Issue OwnerCurrent Issue Owner: @hoangzinh

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 27, 2024
  2. melvin-bot commented on Aug 27, 2024

    @melvin-bot

    Triggered auto assignment to @muttmuure (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.

  3. dangrous commented on Aug 27, 2024

    @dangrous
    ContributorAuthor

    The parsing is actually wonkier than this on staging/prod so this bug isn't visible yet, but it will be when THAT parsing is fixed by #47838. Making this so I don't forget, but no action at the moment @muttmuure!

  4. melvin-bot commented on Aug 27, 2024

    @melvin-bot

    📣 @c0ffincolors! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  5. Nodebrute commented on Aug 27, 2024

    @Nodebrute
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-08-27 16:19:13 UTC.

    Proposal

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

    Incorrect parsing for backticks with a space in between them

    What is the root cause of that problem?

    We are checking that there is at least one whitespace character
    https://github.com/Expensify/expensify-common/blob/d11466167bc562447d2dfdad624145040153efae/lib/ExpensiMark.ts#L193

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

    Remove \S+? from this regex
    https://github.com/Expensify/expensify-common/blob/d11466167bc562447d2dfdad624145040153efae/lib/ExpensiMark.ts#L193

    Updated regex

                    regex: /(\B|_|)&#x60;((?:&#x60;)*)(?!&#x60;)(.*?.*?)(?<!&#x60;)((?:&#x60;)*)(&#x60;)(\B|_|)(?!&#x60;|[^<]*<\/pre>|[^<]*<\/video>)/gm,
    

    Result:
    Screenshot 2024-08-27 at 9 18 22 PM

    Or

                    regex: /(\B|_|)&#x60;((?:&#x60;)*)(?!&#x60;)(?<!&#x60;)((?:&#x60;)*)(&#x60;)(\B|_|)(?!&#x60;|[^<]*<\/pre>|[^<]*<\/video>)/gm,
    

    What alternative solutions did you explore? (Optional)

  6. tsa321 commented on Aug 28, 2024

    @tsa321
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-08-28 11:10:18 UTC.

    Proposal

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

    Incorrect parsing for backticks with a space in between them

    What is the root cause of that problem?

    The regex for inline code:

    https://github.com/Expensify/expensify-common/blob/d11466167bc562447d2dfdad624145040153efae/lib/ExpensiMark.ts#L193

    that will be modified into :

    /(\B|_|)&#x60;((?:&#x60;)*)(?!&#x60;)(.*?\S+?.*?)(?<!&#x60;)((?:&#x60;)*)(&#x60;)(\B|_|)(?!&#x60;|[^<]*<\/pre>|[^<]*<\/video>)/gm

    won't allow space only inside backtick, in the (.*?\S+?.*?) part

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

    Modify the regex into:

    /(\B|_|)&#x60;((?:&#x60;)*)(?!&#x60;)(.+?)(?<!&#x60;)((?:&#x60;)*)(&#x60;)(\B|_|)(?!&#x60;|[^<]*<\/pre>|[^<]*<\/video>)/gm

    We also need to escape the space character as &nbsp; due to the issue #8720, which is addressed by Expensify/expensify-common#443. Sending an unescaped space or a space-only inlinecode or code block, results in a server error response.


    We should add ' ' : '&nbsp;' in:

    lib/utils.ts#L13

    Additionally, in:

    lib/utils.ts#L33

    we add '&nbsp;': ' '

    And in:

    lib/utils.ts#L43

    we add |nbsp|

    but this will breaks many regexes. We could adjust the regexes accordingly.


    Alternatively, we could escape the space in before return of replace function of ExpensiMark:

    https://github.com/Expensify/expensify-common/blob/331f53580a4ddd7f1c8e73c7c1494d0bb22962c7/lib/ExpensiMark.ts#L855

    Or right before sending the comment:

    reportCommentText = reportComment.commentText;

    and in here:

    reportCommentText = ReportUtils.getParsedComment(text ?? '', {reportID});

    or directly in here:

    reportComment: reportCommentText,

    Or another more appropriate place.

  7. dangrous commented on Aug 30, 2024

    @dangrous
    ContributorAuthor

    almost ready to open this up officially, PR is merged but not yet deployed

  8. melvin-bot commented on Aug 30, 2024

    @melvin-bot

    @muttmuure Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  9. muttmuure commented on Sep 1, 2024

    @muttmuure
    Contributor

    Will wait until we need an external contributor

  10. muttmuure commented on Sep 3, 2024

    @muttmuure
    Contributor

    Not overdue

  11. dangrous commented on Sep 3, 2024

    @dangrous
    ContributorAuthor

    Okay we're ready to go on this one, will make it external

  12. 38 remaining items

  13. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 8, 2024
  14. melvin-bot commented on Oct 8, 2024

    @melvin-bot

    Triggered auto assignment to @anmurali (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.

  15. melvin-bot commented on Oct 15, 2024

    @melvin-bot

    @deetergp, @hoangzinh, @anmurali, @tsa321 Whoops! This issue is 2 days overdue. Let's get this updated quick!

  16. hoangzinh commented on Oct 16, 2024

    @hoangzinh
    Contributor

    BugZero Checklist:

  17. hoangzinh commented on Oct 16, 2024

    @hoangzinh
    Contributor

    not overdue, it's ready for payment cc @anmurali

  18. melvin-bot commented on Oct 23, 2024

    @melvin-bot

    @deetergp, @hoangzinh, @anmurali, @tsa321 Whoops! This issue is 2 days overdue. Let's get this updated quick!

  19. hoangzinh commented on Oct 24, 2024

    @hoangzinh
    Contributor

    cc @anmurali on payment

  20. melvin-bot commented on Oct 31, 2024

    @melvin-bot

    @deetergp, @hoangzinh, @anmurali, @tsa321 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  21. hoangzinh commented on Nov 1, 2024

    @hoangzinh
    Contributor
  22. anmurali commented on Nov 5, 2024

    @anmurali

    Paid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions