Org-mode mailing list
 help / color / mirror / Atom feed
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
Message-ID: <s4cjck$156g$> (raw)
In-Reply-To: <s4cim4$47c$>

* 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

It is not documented what browser or desktop environment adds extra
slash before "?".  Accordingly to, 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.")

  parent reply	other threads:[~2021-04-04 14:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-04 14:32 Broken org-protocol tests Maxim Nikulin
2021-04-04 14:40 ` [PATCH 1/3] test-org-protocol.el: Fix the case for parse parameters with complex argument Maxim Nikulin
2021-04-04 14:44 ` Maxim Nikulin [this message]
2021-04-04 14:44 ` [PATCH 3/3] test-org-protocol.el: Add expected failures for file:/// URLs Maxim Nikulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='s4cjck$156g$' \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ \
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:

AGPL code for this site: git clone