org-download

a fork of abo-abo's org-download
git clone https://git.trogloxene.org/org-download.git
Log | Files | Refs | README

commit 5e52fc4a7e5389f7ad9bf8c37f5663c39c8834fc
parent 19e166f0a8c539b4144cfbc614309d47a9b2a9b7
Author: archiif <60074051+archiif@users.noreply.github.com>
Date:   Mon, 25 Apr 2022 09:10:49 +0700

org-download.el (org-download--fullname): A more correct way of setting file extensions

In some cases, simply appending a file extension will cause the resulting filename to have multiple file extensions (ugly!), especially when downloading from URLs. With this change, the function will remove any existing extension before appending a new one.
Diffstat:
Morg-download.el | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/org-download.el b/org-download.el @@ -289,7 +289,7 @@ EXT can hold the file extension, in case LINK doesn't provide it." (when (string-match ".*?\\.\\(?:png\\|jpg\\)\\(.*\\)$" filename) (setq filename (replace-match "" nil nil filename 1))) (when ext - (setq filename (concat filename "." ext))) + (setq filename (concat (file-name-sans-extension filename) "." ext))) (abbreviate-file-name (expand-file-name (funcall org-download-file-format-function filename)