I still get this bug about pasting an image from a browser, that was discussed here and supposed to be fixed in 0.12.5.
It’s when a link to the image is pasted instead of the actual image.
It works in Chrome and Firefox but not in Safari, which I’m using.
And images are pasted correctly in Photoshop and Preview, so it’s not only a Safari thing.
Using Obsidian 1.1.9.
Here is a Linux user facing the same issue: URL link when pasting copied image from website.
Except for me it doesn’t work to right click and “Paste as plain text”.
Cmd+shift+V also makes no difference.
Another Mac user documented the issue well here: Handling of image copy/paste inconsistent across common MacOS web browsers - Bug graveyard - Obsidian Forum.
That was supposed to be fixed in 0.14.3 but I guess the bug is still there…
Thanks for including context and links! I can reproduce (in some cases).
I’m not refuting your bug. I’m adding context for anyone testing, since as WhiteNoise pointed out, different browsers store the clipboard differently:
An image copied in Safari seems to be primarily stored as a url in the clipboard. (Although yes I know multiple things can get stored in the clipboard. Analyzing the clipboard with an osascript shows there is image data too. And I tested pasting with no internet connection, so I conclude it isn’t downloading it during pasting.)
Go to Finder. Edit → Show Clipboard.
If you copy an image in Chrome, you’ll see an image.
If you copy an image in Safari, you’ll see a url.
Also, I have mixed results when testing in Safari:
- If I copy an image that is a link (like a blog logo header), then it doesn’t work, because it pastes the image and link into Obsidian.
- If I copy an image that isn’t a link, it pastes directly as an attached image for me in Obsidian.
Thanks for testing.
Yeah, it’s funny that Finder displays it as text. It’s clearly not the full story.
Can also confirm that copying an image that’s not a link, eg. when nothing else is shown in the browser window, works.
I don’t know if this is something Obsidian should solve, necessarily. It sounds like it’s a Safari problem.
When I select “Copy image” from e.g., a forum profile pic, it pastes
[!(https://forum.obsidian.md/user_avatar/forum.obsidian.md/porcorosso/45/24817_2.png)](https://forum.obsidian.md/u/PorcoRosso), which renders as:
Unless and until Safari changes this behaviour, the best approach is probably right-click → Open image in new tab → switch to the tab → right-click → copy image, then paste into Obsidian.
Here is a tool for testing clipboard data.
In my “blog header logo” test in Safari, I see multiple classes of data in the clipboard. From Safari, the order is:
- file: image.png (image/png)
- string (text/html)
- string (text/plain)
- file (image/png)
In Firefox, the order is (and fewer elements):
- text/html (the url of the image)
- file: image.png (image/png)
- item: string (text/html)
- item: file (image/png)
So the image data is in there, but seemingly hidden away underneath two other classes of text data. I’m not a developer, but it seems like something that can be accounted for, but it could also potentially be full of other edge-case bugs where images start getting pasted when text is intended by the user.
(A graphics program can unambiguously interpret this as an image, if it finds any class that is an image.)
It does indeed look like a Safari bug. Also discussed in relation to other apps: [Bug?] Safari can’t copy images to clipboard? | MacRumors Forums.
Anyways, I noticed that one loses the original filename when pasting, which I think is a shame, so I’ll look for another method.
Thanks for the help .