Fix placeholder finder
This commit is contained in:
parent
9caecc8a07
commit
898ea300a9
2 changed files with 7 additions and 2 deletions
|
@ -422,14 +422,17 @@ node * _r3_tree_insert_pathl(node *tree, char *path, int path_len, route * route
|
||||||
if ( prefix_len == 0 ) {
|
if ( prefix_len == 0 ) {
|
||||||
// there are two more slugs, we should break them into several parts
|
// there are two more slugs, we should break them into several parts
|
||||||
if ( count_slug(path, path_len) > 1 ) {
|
if ( count_slug(path, path_len) > 1 ) {
|
||||||
char *p = find_slug_placeholder(path, NULL);
|
int slug_len;
|
||||||
|
char *p = find_slug_placeholder(path, &slug_len);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
assert(p);
|
assert(p);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// find the next one
|
// find the next one
|
||||||
p = find_slug_placeholder(p + 1, NULL);
|
if(p) {
|
||||||
|
p = find_slug_placeholder(p + slug_len + 1, NULL);
|
||||||
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
assert(p);
|
assert(p);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -183,6 +183,8 @@ char * compile_slug(char * str, int len)
|
||||||
}
|
}
|
||||||
s1 += s1_len;
|
s1 += s1_len;
|
||||||
strncat(o, s1, strlen(s1));
|
strncat(o, s1, strlen(s1));
|
||||||
|
|
||||||
|
printf("compiled slug: %s\n", out);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue