diff --git a/lisp/org-persist.el b/lisp/org-persist.el index fe339505c..30c5e17d4 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -662,12 +662,13 @@ COLLECTION is the plist holding data collection." (file-copy (org-file-name-concat org-persist-directory (format "%s-%s.%s" persist-file (md5 path) ext)))) - (unless (file-exists-p (file-name-directory file-copy)) - (make-directory (file-name-directory file-copy) t)) - (if (org--should-fetch-remote-resource-p path) - (url-copy-file path file-copy 'overwrite) - (error "The remote resource %S is considered unsafe, and will not be downloaded." - path)) + (unless (file-exists-p file-copy) + (unless (file-exists-p (file-name-directory file-copy)) + (make-directory (file-name-directory file-copy) t)) + (if (org--should-fetch-remote-resource-p path) + (url-copy-file path file-copy 'overwrite) + (error "The remote resource %S is considered unsafe, and will not be downloaded." + path))) (format "%s-%s.%s" persist-file (md5 path) ext))))) (defun org-persist-write:index (container _)