Commit e906cd0d authored by Robert Pluim's avatar Robert Pluim

Fix gravatar tests

* lisp/image/gravatar.el (gravatar--service-libravatar): Don't error
when failing to parse email address, just return the default URL.

* test/lisp/image/gravatar-tests.el (gravatar-build-url): Adjust
for new default gravatar url.
parent 0fe72004
Pipeline #5082 failed with stage
in 90 minutes and 2 seconds
......@@ -142,19 +142,19 @@ Note that certain services might ignore other options, such as
"Find domain that hosts avatars for email address ADDR."
;; implements https://wiki.libravatar.org/api/
(save-match-data
(unless (string-match ".+@\\(.+\\)" addr)
(error "%s is not an email address" addr))
(let ((domain (match-string 1 addr)))
(catch 'found
(dolist (record '(("_avatars-sec" . "https")
("_avatars" . "http")))
(let* ((query (concat (car record) "._tcp." domain))
(result (dns-query query 'SRV)))
(when result
(throw 'found (format "%s://%s/avatar"
(cdr record)
result)))))
"https://seccdn.libravatar.org/avatar"))))
(if (not (string-match ".+@\\(.+\\)" addr))
"https://seccdn.libravatar.org/avatar"
(let ((domain (match-string 1 addr)))
(catch 'found
(dolist (record '(("_avatars-sec" . "https")
("_avatars" . "http")))
(let* ((query (concat (car record) "._tcp." domain))
(result (dns-query query 'SRV)))
(when result
(throw 'found (format "%s://%s/avatar"
(cdr record)
result)))))
"https://seccdn.libravatar.org/avatar")))))
(defun gravatar-hash (mail-address)
"Return the Gravatar hash for MAIL-ADDRESS."
......
......@@ -67,6 +67,6 @@
(gravatar-force-default nil)
(gravatar-size nil))
(should (equal (gravatar-build-url "foo") "\
https://www.gravatar.com/avatar/acbd18db4cc2f85cedef654fccc4a4d8?r=g"))))
https://seccdn.libravatar.org/avatar/acbd18db4cc2f85cedef654fccc4a4d8?r=g"))))
;;; gravatar-tests.el ends here
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment