org-file-contents: Consider all remote files unsafe
authorIhor Radchenko <yantar92@posteo.net>
Tue, 20 Feb 2024 11:59:20 +0000 (14:59 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sun, 24 Mar 2024 12:41:10 +0000 (08:41 -0400)
* lisp/org/org.el (org-file-contents): When loading files, consider all
remote files (like TRAMP-fetched files) unsafe, in addition to URLs.

lisp/org/org.el

index 0f5d17deee2e0e01badc8081f0fc46e57468888e..76559c91cd3ca093b20401fe5b09c63d4683c502 100644 (file)
@@ -4576,12 +4576,16 @@ from file or URL, and return nil.
 If NOCACHE is non-nil, do a fresh fetch of FILE even if cached version
 is available.  This option applies only if FILE is a URL."
   (let* ((is-url (org-url-p file))
+         (is-remote (condition-case nil
+                        (file-remote-p file)
+                      ;; In case of error, be safe.
+                      (t t)))
          (cache (and is-url
                      (not nocache)
                      (gethash file org--file-cache))))
     (cond
      (cache)
-     (is-url
+     ((or is-url is-remote)
       (if (org--should-fetch-remote-resource-p file)
           (condition-case error
               (with-current-buffer (url-retrieve-synchronously file)