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

Copy button copied random code block #1296

Open
zanderhorstman opened this issue Nov 4, 2021 · 1 comment
Open

Copy button copied random code block #1296

zanderhorstman opened this issue Nov 4, 2021 · 1 comment

Comments

@zanderhorstman
Copy link

Current behavior

I used the copy button inside a code block to copy a command we use on our servers for deactivating and deleting SSL certificates. The box that was actually copied, however, contained the root directory for all of our websites as well as a return character. So when I pasted what i copied, all the files in our root dir were immediately deleted (part of the process includes an rm -rf, which is unfortunately where i was at before i pasted). Screenshots would not help here as its not a visual issue, nor was there a console error.

Expected behavior

Copy button should copy the code block it's nested within.

Steps to reproduce

Create 5-10 code blocks. put a one-line command in each code block, then pick a code block near the bottom, hit enter and put another command in it. Then go copy a different code block using the copy to clipboard button and paste it into a text file. About 1 in 10 times you use the copy to clickboard button, it will copy the block with multiple lines.

A temporary fix to prevent this that i'm using, is to avoid using returns inside code blocks. I also removed the root / from commands which contained it. However, random stuff still gets copied sometimes, so as an extra precaution i also paste what i copied into a text document before actually pasting it into the terminal. It's not optimal, but at least it's safer.

Environment

Desktop/Web

  • Boost Note version: Current Web version (boostnote.io)
  • OS version and name: Ubuntu 20.04
@zanderhorstman zanderhorstman changed the title Minor issue with major consequences Copy button coped random code block Nov 4, 2021
@zanderhorstman zanderhorstman changed the title Copy button coped random code block Copy button copied random code block Nov 4, 2021
@Komediruzecki
Copy link
Contributor

Komediruzecki commented Nov 21, 2021

Hi,

sorry for the delay,

I tried this but cannot get it to copy the wrong one.

It would help if you have an exact example to reproduce this, with commands and code blocks.

Copy button should copy the code block it's nested within.

This should always happen, each code block has its own copy button and should copy its content. The only thing I can think of if the first copy succeeded and the second didn't, so you are left with previously clicked copy button content in the clipboard.

And no nested code blocks are allowed so only one block is copied each time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants