RainCat1998 / obsidian-custom-attachment-location

Customize attachment location with variables($filename, $data, etc) like typora.
MIT License
228 stars 36 forks source link

[BUG] Image pasted from clipboard as .octet-stream and in wrong location #100

Closed daeh closed 1 month ago

daeh commented 1 month ago

I've been using this plugin for years, so thanks for all the work in developing it.

I'm having a new issue, I think it just started within the last couple days (well after the release of 4.22.1), so I'm not sure what the root cause is, possibly an interaction with the Obsidian version.

Now, when I paste an image from the clipboard, it's inserted into the note as a .octet-stream file in the Obsidian-specified attachment location, rather than as a png in the location specified by this plugin.

E.g. a pasted link is: ![[../Attachments/Pasted image 20240922172957.octet-stream]]

If I drag an image into the note, everything works as intended. E.g. a dragged and dropped image is:

![[_resources/test note.assets/image.png]]

If I turn off this plugin, and paste an image from the clipboard, it's pasted as a png in Obsidian's default folder (as expected). E.g. ![[../Attachments/Pasted image 20240922173247.png]]

And if I paste an image from the clipboard into Typora, it's inserted as a png.


So it looks like it's something to do with this plugin to me, but I'm not sure how to debug from here. It looks like the plugin is trying to take over the default Obsidian pasted image process but isn't succeeding, so it ends up in the Obsidian-specified file location but as a different file format.

https://github.com/user-attachments/assets/26c56435-2344-460c-9ab4-014d757dbbe7


I didn't see anything that looked useful in the developer console, but these are the messages:

plugin:obsidian-custom-attachment-location:1770 chainAsyncFn:end Objectduration: 56timestampEnd: 1727040557009timestampStart: 1727040556953[[Prototype]]: Objectconstructor: ƒ Object()hasOwnProperty: ƒ hasOwnProperty()isPrototypeOf: ƒ isPrototypeOf()propertyIsEnumerable: ƒ propertyIsEnumerable()toLocaleString: ƒ toLocaleString()toString: ƒ toString()valueOf: ƒ valueOf()__defineGetter__: ƒ __defineGetter__()__defineSetter__: ƒ __defineSetter__()__lookupGetter__: ƒ __lookupGetter__()__lookupSetter__: ƒ __lookupSetter__()__proto__: (...)get __proto__: ƒ __proto__()set __proto__: ƒ __proto__()
plugin:obsidian-custom-attachment-location:8522 Handle Note Paste

Obsidian: Version 1.7.2 (Installer 1.6.7) Custom Attachment Location: 4.22.1 MacOS 14.7 (M2 Max)

Settings: location for new attachments: ./_resources/${filename}.assets pasted file name: file-${date:YYYYMMDDHHmmssSSS}

CleanShot 2024-09-22 at 17 54 44

mnaoumov commented 1 month ago

@daeh you didn't follow the bug template. You had to attach the vault with the problem

mnaoumov commented 1 month ago

Could not reproduce

https://github.com/user-attachments/assets/d62f41eb-e88e-4faf-a443-4b9a523d7c87

daeh commented 1 month ago

Thanks for the quick response. I'm going to be preoccupied for a bit and not sure when I'll have time to dig into what's going on with my setup. I'll close this for now and reopen if I make a minimal vault that reproduces the issue.