Merge branch 'bc/wildcard-credential'
Update the parser used for credential.<URL>.<variable> configuration, to handle <URL>s with '/' in them correctly. * bc/wildcard-credential: credential: fix matching URLs with multiple levels in path
This commit is contained in:
8
strbuf.c
8
strbuf.c
@ -479,15 +479,17 @@ void strbuf_addbuf_percentquote(struct strbuf *dst, const struct strbuf *src)
|
||||
}
|
||||
}
|
||||
|
||||
#define URL_UNSAFE_CHARS " <>\"%{}|\\^`:/?#[]@!$&'()*+,;="
|
||||
#define URL_UNSAFE_CHARS " <>\"%{}|\\^`:?#[]@!$&'()*+,;="
|
||||
|
||||
void strbuf_add_percentencode(struct strbuf *dst, const char *src)
|
||||
void strbuf_add_percentencode(struct strbuf *dst, const char *src, int flags)
|
||||
{
|
||||
size_t i, len = strlen(src);
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
unsigned char ch = src[i];
|
||||
if (ch <= 0x1F || ch >= 0x7F || strchr(URL_UNSAFE_CHARS, ch))
|
||||
if (ch <= 0x1F || ch >= 0x7F ||
|
||||
(ch == '/' && (flags & STRBUF_ENCODE_SLASH)) ||
|
||||
strchr(URL_UNSAFE_CHARS, ch))
|
||||
strbuf_addf(dst, "%%%02X", (unsigned char)ch);
|
||||
else
|
||||
strbuf_addch(dst, ch);
|
||||
|
||||
Reference in New Issue
Block a user