branch: externals-release/org commit 24a7ed50b3d856aa33682d5fe9843ce28b565ffc Author: Maxim Nikulin <maniku...@gmail.com> Commit: Bastien Guerry <b...@gnu.org>
org-protocol.el: Fix detection of old-style URIs * lisp/org-protocol.el (org-protocol-check-filename-for-protocol): Avoid incorrect regexp in check whether command line argument uses new syntax. Fix failures of org-protocol tests. Question mark was not escaped in the previous version 928e67df7e, so any string was matched by lazy "*". Match in never used, thus `string-match-p` would be better, but actually regexp is redundant here. It is not documented what browser or desktop environment adds extra slash before "?". Accordingly to mid:a2b0655f-bf28-4943-bc05-99021bfda...@robewald.de, Windows may be involved. Likely it happens with double slash after schema as in org-protocol://capture?url=URL&title=TITLE due to subprotocol is considered as host name and URI is normalized by adding a slash as mandatory path part before "?" query. So just reverting the original commit will likely cause a regression. Another guess is that with single or triple slash (org-protocol:/capture?url=URL) subprotocol is a part of path thus no "smart" actions are necessary. --- lisp/org-protocol.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el index 878423d..9969372 100644 --- a/lisp/org-protocol.el +++ b/lisp/org-protocol.el @@ -629,7 +629,7 @@ CLIENT is ignored." (greedy (plist-get (cdr prolist) :greedy)) (split (split-string fname proto)) (result (if greedy restoffiles (cadr split))) - (new-style (string-match "/*?" (match-string 1 fname)))) + (new-style (not (= ?: (aref (match-string 1 fname) 0))))) (when (plist-get (cdr prolist) :kill-client) (message "Greedy org-protocol handler. Killing client.") (server-edit))