obsidian-paste-image-rename icon indicating copy to clipboard operation
obsidian-paste-image-rename copied to clipboard

Paste image, the file will be rename, but the name in .md is still the original one.

Open taso998 opened this issue 2 years ago • 10 comments

Describe the bug Paste image, the file will be rename, but the name in .md is still the original one.

Environments (please complete the following information):

  • OS: Win10
  • Use markdown format
  • Debug info: no "show debug info" in my command ...

To Reproduce Steps to reproduce the behavior:

  1. Ctrl+C the file or screenshot captured in picpick.
  2. Paster in OB. The log will show "rename to xxx(md file title).jpg/png
  3. Confirm the image file has been copy to the attachment folder and rename to xxx.jpg/png
  4. But in md, the link is still pointing to the original file name before renaming. Screenshots image

**Feature request We I paste image from screenshot tool or web browser, the format is .PNG, the file size is large, is it possible to add a function to convert it to .jpg automatically? There is a plugin called"paster image png to jepg", but its rename functon is not very powerful...

Thank you for your great job!

taso998 avatar May 26 '22 13:05 taso998

Hello. I confirm the same behavior, file is renamed, but the pasted description to the markdown file is not changed. Obsidian: v0.14.15 OS: macOS 12.1.

alx72n avatar Jun 15 '22 07:06 alx72n

I confirm the same behavior too!!! File is renamed, but the pasted description to the markdown file is not changed!!!!!!!!!!! Obsidian: v0.14.16 OS: macOS11.6.6

And it work some time, it not work some time, so fuck.

Ch4mpa9ne avatar Jun 18 '22 12:06 Ch4mpa9ne

Same issue here. Looks like a race condition of some sort.

aviau avatar Jun 25 '22 05:06 aviau

Looks like a race condition of some sort.

Also experiencing this. Seems to only happen sometimes, so this would make sense.

jonnymaceachern avatar Jun 26 '22 15:06 jonnymaceachern

Same issue here Obsidian: v0.15.8 OS: win11

octo-kumo avatar Jul 25 '22 14:07 octo-kumo

Same issue here.

HiramYang avatar Oct 11 '22 07:10 HiramYang

我也遇到了这个情况,并且提供了录屏证据

lxq1 avatar Oct 19 '22 05:10 lxq1

These should be the same questions:

Duplicate of #24 Duplicate of #20 Duplicate of #13 Duplicate of #11

jerviscui avatar Oct 20 '22 02:10 jerviscui

These should be the same questions:

Duplicate of #24 Duplicate of #20 Duplicate of #13 Duplicate of #11

OK If disabling auto rename the link is changed. When the rename window pops up, wait a moment and then confirm will modify the links in the file.

I think the problem arises here:

https://github.com/reorx/obsidian-paste-image-rename/blob/caf25cf58e04ea2f7206bd389dccedb8a6e12670/src/main.ts#L179-L182

Why I can't see the log in the console? I try the DEBUG is true: image

jerviscui avatar Oct 20 '22 02:10 jerviscui

我重新启动软件几次后,又能够正常使用了

HiramYang avatar Oct 20 '22 02:10 HiramYang

Will it still be updated?

jerviscui avatar Oct 30 '22 03:10 jerviscui

还继续开发更新吗??

lxq1 avatar Nov 04 '22 03:11 lxq1

To @jerviscui @lxq1 and all whom it may concern, I'm busy preparing for an exam recently and am not available to review the issues, so sorry for getting you into trouble while using this plugin. The exam ends on the 16th of November, after that I'll get back to dive into the problem ASAP.

reorx avatar Nov 04 '22 10:11 reorx

It doesn't work properly in Obsidian 1.1.9 either.

alexinea avatar Dec 26 '22 05:12 alexinea

@reorx Any update? I love the plugin, just this not working makes things not really helpful.

I can reproduce the issue only when hitting "rename" very fast. If I wait 2-3s before clicking rename, all goes well.

fxmarty avatar Dec 28 '22 14:12 fxmarty

To Reproduce:

  1. Switch off Use [[WikiLinks]],
  2. Create a new note named: Untitled, note filename contains a space char.
  3. Paste an image
    • Link text under cursor should be ![](Pasted%20image%2020221229124433.png)
    • Dive into main.js:
      • const originStem = file.basename; // HERE WILL BE 'Pasted image 20221229124433.png'
      • linkTextRegex = new RegExp("!\\[\\]\\(([^[\\]]*\\/)?${originStem}\\.${ext}\\)");
      • Pasted image 20221229124433.png not matches Pasted%20image%2020221229124433.png
  4. Auto rename switched ON, link text not replaced.
  5. Auto rename switched OFF, Click the Rename button on modal, link text not replaced.

yueim avatar Dec 29 '22 04:12 yueim

测试了一下只OB 1.19 只在打开WIKI语法时正常生效, 关闭WIKI语法则出现这个问题, 源码逻辑应该是有问题

one0oneChen avatar Jan 05 '23 15:01 one0oneChen

Hey guys, this issue should be fixed in 1.6.0, please update and try if it works. You can also look at the release log, which contains more details and my sincere gratitude to you.

reorx avatar Jan 28 '23 14:01 reorx