BoostIO / BoostNote-App

Boost Note is a document driven project management tool that maximizes remote DevOps team velocity.

Home Page:https://boostnote.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Copy button copied random code block

zanderhorstman opened this issue · comments

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

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.