1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

Fix import of keys in buffer created by epa-search-keys

* lisp/epa-ks.el (epa-ks--query-url): Add operation parameter.
(epa-ks--fetch-key, epa-search-keys): Use it.
This commit is contained in:
Filipp Gunbin 2023-03-13 19:27:13 +03:00
parent 36ade0704e
commit 46f9e53c3d

View File

@ -140,8 +140,8 @@ Keys are marked using `epa-ks-mark-key-to-fetch'."
(epa-ks--fetch-key id)))))
(tabulated-list-clear-all-tags))
(defun epa-ks--query-url (query exact)
"Return URL for QUERY.
(defun epa-ks--query-url (query exact &optional operation)
"Return URL for QUERY and OPERATION (defaults to \"index\").
If EXACT is non-nil, don't accept approximate matches."
(format "https://%s/pks/lookup?%s"
(cond ((null epa-keyserver)
@ -154,13 +154,13 @@ If EXACT is non-nil, don't accept approximate matches."
(url-build-query-string
(append `(("search" ,query)
("options" "mr")
("op" "index"))
("op" ,(or operation "index")))
(and exact '(("exact" "on")))))))
(defun epa-ks--fetch-key (id)
"Send request to import key with specified ID."
(url-retrieve
(epa-ks--query-url (concat "0x" (url-hexify-string id)) t)
(epa-ks--query-url (concat "0x" (url-hexify-string id)) t "get")
(lambda (status)
(when (plist-get status :error)
(error "Request failed: %s"
@ -236,7 +236,7 @@ enough, since keyservers have strict timeout settings."
(erase-buffer))
(epa-ks-search-mode))
(url-retrieve
(epa-ks--query-url query exact)
(epa-ks--query-url query exact "index")
(lambda (status)
(when (plist-get status :error)
(when buf