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 2022-05-20][$2000] Copying / pasting code between < and /> seems broken #7912

Closed
mvtglobally opened this issue Feb 25, 2022 · 64 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@mvtglobally
Copy link

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


Action Performed:

  1. Type something like and send the message
  2. Try to select, copy, then paste into a new message

Expected Result:

Exactly what you copied should be pasted

Actual Result:

The code gets stripped
Issue happens when selecting with a mouse, not when using the Copy button

Workaround:

unknown

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number: 1.1.40-0
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2022-02-14.at.6.31.29.PM.mov

Expensify/Expensify Issue URL:
Issue reported by: @Beamanator
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1644856333330159

View all open jobs on GitHub

@MelvinBot
Copy link

Triggered auto assignment to @iwiznia (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@iwiznia iwiznia removed their assignment Feb 25, 2022
@iwiznia iwiznia added the External Added to denote the issue can be worked on by a contributor label Feb 25, 2022
@MelvinBot
Copy link

Triggered auto assignment to @adelekennedy (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@mateusbra
Copy link
Contributor

PROPOSAL

We have to change how we strip html when copying to clipboard, at the moment we are only replacing everything within <> for an empty string here:
https://github.com/Expensify/expensify-common/blob/f77bb4710c13d01153716df7fb087b637ba3b8bd/lib/str.js#L306-L318

@adelekennedy
Copy link

internal
external

@MelvinBot
Copy link

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

@MelvinBot MelvinBot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 26, 2022
@MelvinBot
Copy link

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

@parasharrajat
Copy link
Member

Thanks for the proposal @mateusbra. Could you please root cause details to your proposal? and tell us how did you reach your solution.

@dennismunene
Copy link
Contributor

dennismunene commented Feb 27, 2022

PROPOSAL

We need to change how we handle pasted HTML here.

Change this

https://github.com/Expensify/expensify-common/blob/f77bb4710c13d01153716df7fb087b637ba3b8bd/lib/str.js#L312-L318

To

Only strip off valid html tags

    /**
     * Gets the textual value of the given string.
     *
     * @param {String} str The string to fetch the text value from.
     * @return {String} The text from within the HTML string.
     */
    stripHTML(str) {
        if (!this.isString(str)) {
            return '';
        }

        return str.replace(/<\/?(a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdi|bdo|bgsound|big|blink|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|data|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|img|input|ins|isindex|kbd|keygen|label|legend|li|link|listing|main|map|mark|marquee|menu|menuitem|meta|meter|nav|nobr|noframes|noscript|object|ol|optgroup|option|output|p|param|plaintext|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|source|spacer|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video|wbr|xmp|path|svg|...)\b[^<>]*>/g, '');
    },

SCREEN RECORDING

Screen.Recording.2022-02-27.at.11.43.17.mov

@parasharrajat
Copy link
Member

Thanks for the proposal @dennismunene. Did you try?

 `<someComponent />` 

as message.

@dennismunene
Copy link
Contributor

@parasharrajat yes I have , works as expected.

@parasharrajat
Copy link
Member

Ok. Thanks but I don't consider this a proper approach.

const parser = new ExpensiMark(); 
     const markdownText = parser.htmlToMarkdown(html); 

This step is important for the app.

@dennismunene
Copy link
Contributor

@parasharrajat updated my proposal.

@parasharrajat
Copy link
Member

Thanks, @dennismunene but I still think we can do better.

  1. StripHTML is doing its job of removing HTML but the question is why are getting HTML at this stage? HTML should have been converted to MD by now.

Now there are two things to compare.

  1. Copy to clipboard and Selection copy via Ctrl+C.

Copy to clipboard works. But the selection does not. So it must have given you the idea by now what is wrong.

@mateusbra
Copy link
Contributor

mateusbra commented Feb 28, 2022

Thanks for the proposal @mateusbra. Could you please root cause details to your proposal? and tell us how did you reach your solution.

@parasharrajat thank you for the review. I think this is gonna be more complex than I thought, please ignore my proposal by now

@melvin-bot
Copy link

melvin-bot bot commented Apr 20, 2022

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.1.55-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2022-04-27. 🎊

@melvin-bot melvin-bot bot removed the Overdue label Apr 20, 2022
@parasharrajat
Copy link
Member

parasharrajat commented Apr 21, 2022

@gladiator-1 I am facing the following error on the console. Sorry, it got missed in the PR review. Could you please send a PR to fix it?

image

Steps:

  1. Go to any chat.
  2. Select any string from the message on the web.
  3. Right-click to open the menu. But It throws the error on console and ContextMenu does not open.

@gladiator-1
Copy link
Contributor

@parasharrajat I'm so sorry for this error, PR #8741

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Apr 26, 2022
@adelekennedy
Copy link

@parasharrajat do we still need to wait on payment or are we good to go with the fix in #8741?

@parasharrajat
Copy link
Member

Yes, we have to wait. The new PR is not merged.

marcaaron added a commit that referenced this issue Apr 28, 2022
Fix error message belong to issue #7912
@melvin-bot melvin-bot bot added the Overdue label May 2, 2022
@melvin-bot
Copy link

melvin-bot bot commented May 3, 2022

@parasharrajat, @marcaaron, @adelekennedy, @gladiator-1 Eep! 4 days overdue now. Issues have feelings too...

@adelekennedy
Copy link

it's okay Melvin - we're waiting on the new PR

@melvin-bot melvin-bot bot removed the Overdue label May 3, 2022
@marcaaron
Copy link
Contributor

Unassigning as I'm going OOO for a week. I think we are pretty much good here and just need to assign a new reviewer with PullerBear for whatever PR we are waiting on.

@marcaaron marcaaron removed their assignment May 6, 2022
@melvin-bot melvin-bot bot added the Overdue label May 9, 2022
@melvin-bot
Copy link

melvin-bot bot commented May 9, 2022

@parasharrajat, @adelekennedy, @gladiator-1 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@adelekennedy
Copy link

checking here - it looks like #8741 has been merged, are we good for payment @parasharrajat?

@melvin-bot melvin-bot bot removed the Overdue label May 10, 2022
@parasharrajat
Copy link
Member

Unfortunately not yet. PR is not yet deployed to PRDO.

@melvin-bot melvin-bot bot added Overdue Weekly KSv2 and removed Daily KSv2 Overdue labels May 12, 2022
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2022-04-27] [$2000] Copying / pasting code between < and /> seems broken [HOLD for payment 2022-05-20] [HOLD for payment 2022-04-27] [$2000] Copying / pasting code between < and /> seems broken May 13, 2022
@melvin-bot
Copy link

melvin-bot bot commented May 13, 2022

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.1.57-17 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2022-05-20. 🎊

@mallenexpensify mallenexpensify changed the title [HOLD for payment 2022-05-20] [HOLD for payment 2022-04-27] [$2000] Copying / pasting code between < and /> seems broken [HOLD for payment 2022-05-20][$2000] Copying / pasting code between < and /> seems broken May 20, 2022
@adelekennedy
Copy link

paid and paid!

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 Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests