mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
fix alias with variables, but without captures,
the bug had been introduced in r2566 and r2573
This commit is contained in:
parent
517a8fc588
commit
1e5ef6b0f4
@ -1695,7 +1695,15 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path,
|
|||||||
last = ngx_copy(path->data, clcf->root.data, clcf->root.len);
|
last = ngx_copy(path->data, clcf->root.data, clcf->root.len);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
reserved += alias ? 1 : r->uri.len + 1;
|
|
||||||
|
#if (NGX_PCRE)
|
||||||
|
ngx_uint_t captures;
|
||||||
|
|
||||||
|
captures = alias && clcf->captures;
|
||||||
|
reserved += captures ? 1 : r->uri.len - alias + 1;
|
||||||
|
#else
|
||||||
|
reserved += r->uri.len - alias + 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved,
|
if (ngx_http_script_run(r, path, clcf->root_lengths->elts, reserved,
|
||||||
clcf->root_values->elts)
|
clcf->root_values->elts)
|
||||||
@ -1711,10 +1719,12 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path,
|
|||||||
*root_length = path->len - reserved;
|
*root_length = path->len - reserved;
|
||||||
last = path->data + *root_length;
|
last = path->data + *root_length;
|
||||||
|
|
||||||
if (alias) {
|
#if (NGX_PCRE)
|
||||||
|
if (captures) {
|
||||||
*last = '\0';
|
*last = '\0';
|
||||||
return last;
|
return last;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1);
|
last = ngx_cpystrn(last, r->uri.data + alias, r->uri.len - alias + 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user