App: [$500] Compose -Copy URL to clipboard shows url link and markdown text.

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: 1.4.0-0 Reproducible in staging?: Y Reproducible in production?: Y 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: Applause-Internal Team Slack conversation: @

Action Performed:

  1. Go to https://staging.new.expensify.com
  2. Open any report
  3. Paste *text https://expensify.com#abc*
  4. Send the message
  5. Observe that * bolding doesn’t work.

Expected Result:

Link should be bolded

Actual Result:

Link is not bolded, markdown * are showing

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

https://github.com/Expensify/App/assets/115492554/8070dd8f-7ee6-417f-add6-d5f93867165c

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b6ad7e1bea3c914c
  • Upwork Job ID: 1725070533592285184
  • Last Price Increase: 2024-02-16

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Comments: 64 (29 by maintainers)

Most upvoted comments

Hi @ntdiary - I misunderstood Conor’s comment before, sorry about that! I thought his “workaround” was a proposed solution when it’s actually what the user would have to do to make the whole text line bold.

I did a bit more research and found that it’s possible for URLs to have *'s. For that reason, I think we should leave the current edge-case bug as is.

In the future, after we add live markdown previews, we’ll also add keyboard shortcuts (i.e. Command+b) at some point, which will make this less of an issue.

Proposal

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

URL with hash inside bold markdown does not apply the bold markdown

*text https://expensify.com#abc*

What is the root cause of that problem?

The bold rule is after the auto link rule, The auto link markdown parses url with ending * before bold rule is applied, thus the bold rule does not apply.

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

If Url with ending asterisk is part of string which is likely to be parsed as bold (e.g. *text https://expensify.com#abc*), we should not contain ending * as part of url. To do that, we can add following process in modifyTextForUrlLinks function. The process is to exclude ending asterisk if there is string with asterisk leading to url .

                if (numberOfCharsToRemove) {
                    match[0] = match[0].substring(0, match[0].length - numberOfCharsToRemove);
                    url = url.substring(0, url.length - numberOfCharsToRemove);
                }
            }
--------->
            if (match.index !== 0) {
                const stringBeforeUrl = textToCheck.substring(startIndex, match.index);
                const lastChar = url.charAt(url.length - 1);
                if (lastChar === '*' && stringBeforeUrl.includes(lastChar)) {
                    match[0] = match[0].substring(0, match[0].length - 1);
                    url = url.substring(0, url.length - 1);
                }
            }
<-----------
            replacedText = replacedText.concat(textToCheck.substr(startIndex, (match.index - startIndex)));

we can add relevant test case

This approach does not make other test cases failed.

Will you let me know what the original text is?

@s-alves10 please try with this text *text https://expensify.com#abc*