From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8HjpLxXRaWAZaAEAgWs5BA (envelope-from ) for ; Sun, 04 Apr 2021 16:45:41 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id cK7QKRXRaWBHSQAAB5/wlQ (envelope-from ) for ; Sun, 04 Apr 2021 14:45:41 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1AE442D54A for ; Sun, 4 Apr 2021 16:45:41 +0200 (CEST) Received: from localhost ([::1]:34226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lT40R-000358-4m for larch@yhetil.org; Sun, 04 Apr 2021 10:45:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51558) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lT3zu-00034o-3L for emacs-orgmode@gnu.org; Sun, 04 Apr 2021 10:45:06 -0400 Received: from ciao.gmane.io ([116.202.254.214]:42702) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lT3zs-0003Vh-RS for emacs-orgmode@gnu.org; Sun, 04 Apr 2021 10:45:05 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1lT3zq-0004CB-CR for emacs-orgmode@gnu.org; Sun, 04 Apr 2021 16:45:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org 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: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 28 X-Spam_score: 2.8 X-Spam_bar: ++ X-Spam_report: (2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1617547541; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=J6RPeujA/0/BD8maX2e19xXvc1kD33h0HGOYn07pLsY=; b=fXCwvcptvCTdfbA6J+5zempcTqKsbiZa/Wp8jefWvzcBL/EXxqR5XjaVFE6Ptnqx4N/E21 A7+ltQn8dfZbhulfI7WCXwTs9Lls0OOHPgDNeiQgxXsw1eNDaQbSIHUUwZi1EN62fIVaOu R8Ew/zAtHiYZUGj3osXLjHzlO3puGoc0h91qrAIoBlLbGtu9+a+YWMYm/n5IvNQg2zg6gx +QOA+Sj1rKIWGmVkxMPccT0/giYWgI8ziXmBmkx8S2z2u+yGYeBK18h5SbVmQrSbmBLJnD 4RIGtYqtKk9lnIal1natCEHrrdjjMFArEtKoC2kKHoBu8QIbxPtSCEfn10cgVg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1617547541; a=rsa-sha256; cv=none; b=eB0qVjpGw5PcFbsCH+4OFafvNIFP/tu7N2iTMsFP1DYn3Av+AiBDbYLcoNg8pHYTOM4iuV B1a9nhuIF6LDHkjvMGvhfLaD5FdOLu7sj8x4Kg9W1n3CHdVxqBP+BkRZ4jA6gVClwQCP9J ODBiX8FPtJT6aw79wvt1O+5InoNznyxvCEzFNpteId2LGnRkL90MGXapDxf3f01KBoukHx rN7254/UECkIDpqcEs8DnAZR8BfQUxWXuWBXGeEpOoALMemf3gTapSmtaYxO+PWNWHPJX9 tfwlLYlwUK39pl+ZomMT47VljyYUhyOP6ZTrTXVHw/350/arcKBI/O/VCNVv1A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.84 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 1AE442D54A X-Spam-Score: -1.84 X-Migadu-Scanner: scn0.migadu.com X-TUID: +ALNhSRansHc * 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