From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1 with LMTPS id KPvCLaPyiV4aTQAAk0OIDg (envelope-from ) for ; Sun, 05 Apr 2020 15:00:51 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id sBvvDaLyiV40VwAAB5/wlQ (envelope-from ) for ; Sun, 05 Apr 2020 15:00:50 +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 DBD1C9424A1 for ; Sun, 5 Apr 2020 14:56:15 +0000 (UTC) Received: from localhost ([::1]:48590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jL6h3-0001gP-Iz for larch@yhetil.org; Sun, 05 Apr 2020 10:56:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35110) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jL6gg-0001ct-64 for emacs-orgmode@gnu.org; Sun, 05 Apr 2020 10:55:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jL6ge-0007Y6-P3 for emacs-orgmode@gnu.org; Sun, 05 Apr 2020 10:55:50 -0400 Received: from pie.tf ([62.75.142.128]:57484) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jL6ge-0007X6-JV for emacs-orgmode@gnu.org; Sun, 05 Apr 2020 10:55:48 -0400 Received: from [185.197.132.141] (helo=localhost) by pie.tf with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1jL6gb-0003nk-05 for emacs-orgmode@gnu.org; Sun, 05 Apr 2020 14:55:45 +0000 From: Ferdinand Pieper To: emacs-orgmode@gnu.org Subject: Additonal slashes in URI sent to org-protocol Date: Sun, 05 Apr 2020 16:55:44 +0200 Message-ID: <87zhbq7zin.fsf@pie.tf> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 62.75.142.128 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=default; t=1586098576; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=LkH18yb6yfawUdNM9yjkPf0jLdm323OW9huG8wgYR1g=; b=GSHBDII95irzq2tgdWD2yu4j7mwGLrg+yMg5wwMpRGREBSMmSPhLrJXQJ3JUze3GVFukmB 2Gd64ILTB55T8d0NNqEtSr5XVII2uK+WE3HRx4M8JreapnFoQFMbPXZaySIkxvrIrG81OT G3enyICQ7uajMzCEd7PAy2zZM347L+4= ARC-Seal: i=1; s=default; d=yhetil.org; t=1586098576; a=rsa-sha256; cv=none; b=ldPFuHXzi0qRrKujUxZTqYE/bx/Rcfqcq2r+7gYTbSRjRvm9Fq9TauM8lEIFun+Z0wucQH RGA4wr8VVreMw5OfMuBqPrukNRPwEDmNr0xCABXCtRMhg5dIW/01nco/D/dZEW+FJ5w9+Z ot3CrwNxKBaba2Ps43f4l3Clhk/Ck9U= ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=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-Scanner: scn0 X-Spam-Score: -1.01 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=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-Scan-Result: default: False [-1.01 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.58551033877953]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.33), country: US(-0.01), ip: 209.51.188.17(-0.59)]; TO_DN_NONE(0.00)[]; ARC_SIGNED(0.00)[i=1]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; FROM_NEQ_ENVFROM(0.00)[list_gnu@pie.tf,emacs-orgmode-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-patch]; DMARC_NA(0.00)[pie.tf]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+,1:+,2:+]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: L7NmB/aUmFid --=-=-= Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi everyone, I was trying to set up org-protocol with Firefox (version 74.0) running und= er Windows 10. Unfortunately there seems to be an issue with additional sla= shes added to the URI so org-protocol can not parse it. I setup a bookmark as mentioned in [1]. I changed the bookmark content to t= he new style of org-protocol links as described in [2], resulting in: --8<---------------cut here---------------start------------->8--- javascript:location.href=3D'org-protocol://capture?template=3DL&url=3D'+enc= odeURIComponent(location.href)+'&title=3D'+encodeURIComponent(document.titl= e)+'&body=3D'+encodeURIComponent(window.getSelection()) --8<---------------cut here---------------end--------------->8--- To setup the forwarding to Emacs running inside WSL I used a registry entry= as described on the same page: --8<---------------cut here---------------start------------->8--- REGEDIT4 [HKEY_CLASSES_ROOT\org-protocol] @=3D"URL:Org Protocol" "URL Protocol"=3D"" [HKEY_CLASSES_ROOT\org-protocol\shell] [HKEY_CLASSES_ROOT\org-protocol\shell\open] [HKEY_CLASSES_ROOT\org-protocol\shell\open\command] @=3D"\"C:\\Windows\\System32\\wsl.exe\" emacsclient \"%1\"" --8<---------------cut here---------------end--------------->8--- Somehow Firefox adds another slash inbetween ~capture~ and the questionmark= , so that Emacs receives this call, which I extracted from a Backtrace: --8<---------------cut here---------------start------------->8--- * org-protocol-check-filename-for-protocol("/mnt/c/Windows/system32/org-pro= tocol:/capture/?template=3DL&url=3Dhttps%3A%2F%2Forgmode.org%2F&title=3DOrg= %20mode%20for%20Emacs%20=E2=80=93%20Your%20Life%20in%20Plain%20Text&body=3D= " (("/mnt/c/Windows/system32/org-protocol:/capture/?template=3DL&url=3Dhttp= s%3A%2F%2Forgmode.org%2F&title=3DOrg%20mode%20for%20Emacs%20=E2=80=93%20You= r%20Life%20in%20Plain%20Text&body=3D")) #>) --8<---------------cut here---------------end--------------->8--- The format ~org-protocol:/capture/?template=3DL...~ still seems to be withi= n the HTML spec. But the additional slash makes the function ~org-protocol-= check-filename-for-protocol~ fail to recognize the URI as a capture call. S= ee also the discussion in [3]. I also tried the same bookmark in Chromium (version 83.0) but it also adds = the additional slash. I attached a proposed patch to allow URIs with and without the slash. I'd be happy to know if anybody has a working setup using the bookmark abov= e or similar or if there are other solutions which do not require this patc= h. Otherwise please let me know what is left to do to get this patch applie= d. Thanks! Footnotes: [1] https://orgmode.org/worg/org-contrib/org-protocol.html#org120a44e [2] https://orgmode.org/Changes_old.html#org18864d9 [3] https://github.com/sprig/org-capture-extension/issues/41#issuecomment-5= 78499266 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-protocol-Allow-slashes-after-sub-protocol.patch >From a476821ebecd9649b2c88a86a0562c757bb2c3a0 Mon Sep 17 00:00:00 2001 From: fpi Date: Fri, 3 Apr 2020 19:12:01 +0200 Subject: [PATCH] org-protocol: Allow slashes after sub-protocol This change lets org-protocol handle URIs with additional slashes before the start of the query string, e.g. org-protocol:/capture/?template=... instead of org-protocol:/capture?template=... --- lisp/org-protocol.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el index 55a534d0d..8fbff9611 100644 --- a/lisp/org-protocol.el +++ b/lisp/org-protocol.el @@ -617,13 +617,13 @@ CLIENT is ignored." (let ((proto (concat the-protocol (regexp-quote (plist-get (cdr prolist) :protocol)) - "\\(:/+\\|\\?\\)"))) + "\\(:/+\\|/*\\?\\)"))) (when (string-match proto fname) (let* ((func (plist-get (cdr prolist) :function)) (greedy (plist-get (cdr prolist) :greedy)) (split (split-string fname proto)) (result (if greedy restoffiles (cadr split))) - (new-style (string= (match-string 1 fname) "?"))) + (new-style (string-match (match-string 1 fname) "/*?"))) (when (plist-get (cdr prolist) :kill-client) (message "Greedy org-protocol handler. Killing client.") (server-edit)) -- 2.25.0 --=-=-=--