mirror of
https://git.zx2c4.com/cgit
synced 2024-11-26 02:18:42 +00:00
Fix cgit_parse_url when a repo url is contained in another repo url
For example, if I have two repos (remove-suffix is enabled): /foo /foo/bar http://cgit/foo/bar/ is interpreted as "repository 'foo', command 'bar'" instead of "repository 'foo/bar'"
This commit is contained in:
parent
88b9311323
commit
10451797fa
23
parsing.c
23
parsing.c
@ -17,7 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
void cgit_parse_url(const char *url)
|
void cgit_parse_url(const char *url)
|
||||||
{
|
{
|
||||||
char *cmd, *p;
|
char *c, *cmd, *p;
|
||||||
|
struct cgit_repo *repo;
|
||||||
|
|
||||||
ctx.repo = NULL;
|
ctx.repo = NULL;
|
||||||
if (!url || url[0] == '\0')
|
if (!url || url[0] == '\0')
|
||||||
@ -29,16 +30,20 @@ void cgit_parse_url(const char *url)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = strchr(url, '/');
|
cmd = NULL;
|
||||||
while (!ctx.repo && cmd) {
|
c = strchr(url, '/');
|
||||||
cmd[0] = '\0';
|
while (c) {
|
||||||
ctx.repo = cgit_get_repoinfo(url);
|
c[0] = '\0';
|
||||||
if (ctx.repo == NULL) {
|
repo = cgit_get_repoinfo(url);
|
||||||
cmd[0] = '/';
|
if (repo) {
|
||||||
cmd = strchr(cmd + 1, '/');
|
ctx.repo = repo;
|
||||||
continue;
|
cmd = c;
|
||||||
|
}
|
||||||
|
c[0] = '/';
|
||||||
|
c = strchr(c + 1, '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx.repo) {
|
||||||
ctx.qry.repo = ctx.repo->url;
|
ctx.qry.repo = ctx.repo->url;
|
||||||
p = strchr(cmd + 1, '/');
|
p = strchr(cmd + 1, '/');
|
||||||
if (p) {
|
if (p) {
|
||||||
|
Loading…
Reference in New Issue
Block a user