Extra unwanted image content when pasting

(Clay Heaton) #1

This doesn’t seem to happen all the time, but is tricky when it does. Below, I pasted in a direct link to a tweet. In the editor, when I paste in the link, the following appears, where the URL of a downloaded image appears immediately after the link:

Below here is where the link actually was pasted - you should see the rendered results of the link in the edit window:

Lisa Collins on Twitter: “Chane 2 WIN a PEQ Starter Kit, 1-Year of PEQ Service, and a 16GB iPad Mini! --> http://t.co/euUgghvR8s #PWYL #sponsored”

Note that this happens if you try to put the link inside of code ticks, too. On other occasions, the OneBox seems to appear as expected, but I cannot figure out what the difference is. The bug happens about 50% of the time.

(Clay Heaton) #2

If you manually remove the <img... part that follows the link, then the OneBox usually pops into place as expected, like the following:

(Jeff Atwood) #3

So you are saying when you paste a link directly next to an <img> tag weird things happen?

Is “so… don’t do that” an OK response? :wink:

Note that oneboxing, by definition only occurs when the link is by itself on its own line, with nothing else on the line.

(Clay Heaton) #4

No, I’m saying that when you paste in the link, the <img... stuff magically appears right after the link and causes the OneBoxing not to work.

(Jeff Atwood) #5

Hmm, I can’t repro it. Looks like there is something else in your clipboard when you paste sometimes… any browser plugins or extensions active? Anything on your computer that would mess with the clipboard globally?

(Clay Heaton) #6

Hmm… maybe it’s another crappy MS Office problem? Let me see… Thanks for your patience. :smile:

(Clay Heaton) #7

Alright… so I installed a program that let’s me look at my clipboard, called ClipBuddy. (If there’s a better one, let me know…)

I then opened the Excel file that has all of the Twitter links in it and copied the cell with the link. (BTW, I’m happy to send you the file if you’d like.) ClipBuddy shows this, which doesn’t look like there’s additional garbage after the link, to me:

When I paste that into Discourse, then the <img... tag appears. Does Excel have a secret img payload with copied cells?

If I paste the same thing into Sublime Text, then I just see the link, with no indication there is anything other than text in the link. However, if I then copy it from Sublime Text and paste it into Discourse – no extra img. It must be another MS Office annoying issue?

(Johan Jatko) #8

A program can specify multiple paste formats for a clipboard item. Your program might not pick all of them up?

(See Clipboard Formats (Windows) under “Multiple clipboard formats”.)

(Sam Saffron) #9

I have seen double uploads before (when I paste in stuff it uploads multiple old images) sound similar.

(Jeff Atwood) #10

On Mac or Windows? I have never seen this on Windows?

(Sam Saffron) #11

Seen it on Windows … will try to repro. (having trouble reproing :frowning: )

(Clay Heaton) #12

I’m on Mac 10.9 using Chrome

(Johan Jatko) #13

When you copy a cell in Excel in Windows it also renders the content as an image and inserts it to the clipboard (along with the text version).
I assume this also happens on Mac seeing as the image content is just white with a text link.

If so, is it the JS code for paste that selects the wrong clipboard data or something else?
(FYI cannot repro this on Windows in any way)