Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming attached images moves them to the wrong directory #209

Open
gsingh93 opened this issue May 31, 2023 · 0 comments
Open

Renaming attached images moves them to the wrong directory #209

gsingh93 opened this issue May 31, 2023 · 0 comments

Comments

@gsingh93
Copy link

When org-download-method is set to attach, the download file is placed in a subdirectory of org-attach-id-dir, where the node ID is used as the subdirectory path. For example, create an empty org file, copy the following URL to your clipboard, and then run M-x org-download-yank: https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png

The buffer will now look like this (but with a different ID):

#+DOWNLOADED: https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png @ 2023-05-31 15:08:20
[[attachment:data/BD/A97238-B45D-4FA1-82EE-DC2523033886/2023-05-31_15-08-20_Example.png]]
:PROPERTIES:
:ID:       BDA97238-B45D-4FA1-82EE-DC2523033886
:END:

Now run M-x org-download-rename-last-file and replace the name with "foo" and hit enter. The buffer will now look like this:

#+DOWNLOADED: https://upload.wikimedia.org/wikipedia/commons/7/70/Example.png @ 2023-05-31 15:08:20
[[attachment:data/BD/A97238-B45D-4FA1-82EE-DC2523033886/foo.png]]
:PROPERTIES:
:ID:       BDA97238-B45D-4FA1-82EE-DC2523033886
:END:

But this link is now broken, as the image no longer exists at that location. It's been moved relative to the org file itself. If you add a link like [[file:./foo.png]], that will point to the file.

I believe the intended behavior should be that only the filename should change, not the directory. In this example, "./foo.png" should not have been created, but "data/BD/A97238-B45D-4FA1-82EE-DC2523033886/foo.png" should have been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant