[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] org-protocol.el: Fix detection of old-style URIs
From: |
Maxim Nikulin |
Subject: |
[PATCH 2/3] org-protocol.el: Fix detection of old-style URIs |
Date: |
Sun, 4 Apr 2021 21:44:35 +0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 |
* 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-99021BFDA1B3@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 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