imap-send: URI encode server folder
commit77eac3f89a7b49424e7bb3498d20421878705485
authorNicolas Morey-Chaisemartin <NMoreyChaisemartin@suse.com>
Mon, 18 Dec 2017 19:11:13 +0000 (19 00:41 +0530)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Dec 2017 21:57:06 +0000 (18 13:57 -0800)
tree223db543299064182a1e8c9045b62462f75477d4
parent52015aaf9d19c97b52c47c7046058e6d029ff856
imap-send: URI encode server folder

When trying to send a patch using 'imap-send' with 'curl' and the
following configuration:

[imap]
folder = "[Gmail]/Drafts"
host = imaps://imap.gmail.com
port = 993
sslverify = false

results in the following error,

    curl_easy_perform() failed: URL using bad/illegal format or missing URL

This is a consequence of not URI-encoding the folder portion of
the URL which contains characters such as '[' which are not
allowed in a URI. According to RFC3986, these characters should be
URI-encoded.

So, URI-encode the folder before adding it to the URI to ensure it doesn't
contain characters that aren't allowed in a URI.

Reported-by: Doron Behar <doron.behar@gmail.com>
Signed-off-by: Nicolas Morey-Chaisemartin <NMoreyChaisemartin@suse.com>
Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
imap-send.c