Function: mh-x-image-url-cache-canonicalize

mh-x-image-url-cache-canonicalize is a byte-compiled function defined in mh-xface.el.gz.

Signature

(mh-x-image-url-cache-canonicalize URL)

Documentation

Canonicalize URL.

Replace the ?/ character with a ?! character and append .png. Also replaces special characters with mh-url-hexify-string since not all characters, such as :, are valid within Windows filenames. In addition, replaces * with %2a. See URL https://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/ifaces/iitemnamelimits/GetValidCharacters.asp.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-xface.el.gz
(defun mh-x-image-url-cache-canonicalize (url)
  "Canonicalize URL.
Replace the ?/ character with a ?! character and append .png.
Also replaces special characters with `mh-url-hexify-string'
since not all characters, such as :, are valid within Windows
filenames.  In addition, replaces * with %2a. See URL
`https://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/ifaces/iitemnamelimits/GetValidCharacters.asp'."
  (format "%s/%s.png" mh-x-image-cache-directory
          (mh-replace-regexp-in-string
           "\\*" "%2a"
           (mh-url-hexify-string
            (with-temp-buffer
              (insert url)
              (mh-replace-string "/" "!")
              (buffer-string))))))