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.
This commit is contained in:
parent
0fe7200418
commit
e906cd0d58
2 changed files with 14 additions and 14 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue