Re: [PATCH 2/3] org-protocol.el: Fix detection of old-style URIs

2021-04-28 Thread Bastien
Applied in maint, thanks!

-- 
 Bastien



[PATCH 2/3] org-protocol.el: Fix detection of old-style URIs

2021-04-04 Thread Maxim Nikulin
* 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 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 731f51e19..86a8dc3bc 100644
--- a/lisp/org-protocol.el
+++ b/lisp/org-protocol.el
@@ -631,7 +631,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))
-- 
2.25.1