From: Kyle Meyer <kyle@kyleam.com>
To: zimoun <zimon.toutoune@gmail.com>
Cc: Guix Devel <guix-devel@gnu.org>
Subject: Re: Mummi wishlist: API using Message-ID
Date: Fri, 18 Sep 2020 12:46:51 -0400 [thread overview]
Message-ID: <87r1qzc9s4.fsf@kyleam.com> (raw)
In-Reply-To: <875z8bkaf8.fsf@kyleam.com>
Kyle Meyer writes:
> For public-inbox URLs, there is one character that needs to be escaped:
> "/" with "%2F" (see <https://yhetil.org/guix-devel/_/text/help/>).
Correcting myself: I shouldn't take that help page as a complete
description of what needs to be escaped for public-inbox URLs. It'd be
better to look at what public-inbox's code does itself, particularly
when it generates the path component of the URL for its Archived-At
header. It feeds the message ID through this function:
,----[ lib/PublicInbox/MID.pm ]
| # RFC3986, section 3.3:
| sub MID_ESC () { '^A-Za-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@' }
| sub mid_escape ($) { uri_escape_utf8($_[0], MID_ESC) }
`----
That code came with 9d1e5fad (www: do not unecessarily escape some chars
in paths, 2016-08-14).
So, if you want to perform the same escaping for your custom Elisp
function that generates public-inbox URLs, you can do something like
this:
(let ((unreserved-chars
(append url-unreserved-chars
'(?! ?$ ?& ?' ?\( ?\) ?* ?+ ?, ?= ?: ?@ ?\;))))
(url-hexify-string "88@e.com" unreserved-chars) ; => "88@e.com"
(url-hexify-string "8%@e.com" unreserved-chars) ; => "8%25@e.com"
(url-hexify-string "8/@e.com" unreserved-chars)) ; => "8%2F@e.com"
Or, if you don't mind the unnecessary escaping (particularly of "@"),
you can just use url-hexify-string with the default set of unreserved
characters.
next prev parent reply other threads:[~2020-09-18 16:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 23:51 Mummi wishlist: API using Message-ID zimoun
2020-09-17 10:01 ` Ricardo Wurmus
2020-09-17 10:38 ` zimoun
2020-09-17 11:33 ` Ricardo Wurmus
2020-09-18 5:44 ` Arun Isaac
2020-09-18 3:53 ` Kyle Meyer
2020-09-18 16:46 ` Kyle Meyer [this message]
2022-06-04 11:00 ` Ricardo Wurmus
2022-06-04 22:12 ` Ricardo Wurmus
2022-06-05 10:28 ` zimoun
2022-06-06 11:43 ` Arun Isaac
2022-06-06 12:03 ` Ricardo Wurmus
2022-06-06 12:17 ` Arun Isaac
2022-06-06 12:30 ` Julien Lepiller
2022-06-08 20:14 ` Arun Isaac
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r1qzc9s4.fsf@kyleam.com \
--to=kyle@kyleam.com \
--cc=guix-devel@gnu.org \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).