Function: org-persist-write:url

org-persist-write:url is a byte-compiled function defined in org-persist.el.gz.

Signature

(org-persist-write:url C COLLECTION)

Documentation

Write url container C according to COLLECTION.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-persist.el.gz
(defun org-persist-write:url (c collection)
  "Write url container C according to COLLECTION."
  (org-persist-collection-let collection
    (when (or path (cadr c))
      (when (cadr c) (setq path (cadr c)))
      (let* ((persist-file (plist-get collection :persist-file))
             (ext (file-name-extension path))
             (file-copy (org-file-name-concat
                         org-persist-directory
                         (format "%s-%s.%s" persist-file (md5 path) ext))))
        (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)))))