mirror of
https://git.proxmox.com/git/libgit2
synced 2025-10-16 01:23:02 +00:00
Incorporate feedback
This commit is contained in:
parent
ac72051afa
commit
fe294b95d1
10
src/netops.c
10
src/netops.c
@ -703,24 +703,24 @@ int gitno_extract_url_parts(
|
|||||||
_path = url+u.field_data[UF_PATH].off;
|
_path = url+u.field_data[UF_PATH].off;
|
||||||
_userinfo = url+u.field_data[UF_USERINFO].off;
|
_userinfo = url+u.field_data[UF_USERINFO].off;
|
||||||
|
|
||||||
if (u.field_data[UF_HOST].len) {
|
if (u.field_set & (1 << UF_HOST)) {
|
||||||
*host = git__substrdup(_host, u.field_data[UF_HOST].len);
|
*host = git__substrdup(_host, u.field_data[UF_HOST].len);
|
||||||
GITERR_CHECK_ALLOC(*host);
|
GITERR_CHECK_ALLOC(*host);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u.field_data[UF_PORT].len)
|
if (u.field_set & (1 << UF_PORT))
|
||||||
*port = git__substrdup(_port, u.field_data[UF_PORT].len);
|
*port = git__substrdup(_port, u.field_data[UF_PORT].len);
|
||||||
else
|
else
|
||||||
*port = git__strdup(default_port);
|
*port = git__strdup(default_port);
|
||||||
GITERR_CHECK_ALLOC(*port);
|
GITERR_CHECK_ALLOC(*port);
|
||||||
|
|
||||||
if (u.field_data[UF_PATH].len) {
|
if (u.field_set & (1 << UF_PATH)) {
|
||||||
*path = git__substrdup(_path, u.field_data[UF_PATH].len);
|
*path = git__substrdup(_path, u.field_data[UF_PATH].len);
|
||||||
GITERR_CHECK_ALLOC(*path);
|
GITERR_CHECK_ALLOC(*path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u.field_data[UF_USERINFO].len) {
|
if (u.field_set & (1 << UF_USERINFO)) {
|
||||||
const char *colon = strchr(_userinfo, ':');
|
const char *colon = memchr(_userinfo, ':', u.field_data[UF_USERINFO].len);
|
||||||
if (colon && (colon - _userinfo) < u.field_data[UF_USERINFO].len) {
|
if (colon && (colon - _userinfo) < u.field_data[UF_USERINFO].len) {
|
||||||
*username = unescape(git__substrdup(_userinfo, colon - _userinfo));
|
*username = unescape(git__substrdup(_userinfo, colon - _userinfo));
|
||||||
*password = unescape(git__substrdup(colon+1, u.field_data[UF_USERINFO].len - (colon+1-_userinfo)));
|
*password = unescape(git__substrdup(colon+1, u.field_data[UF_USERINFO].len - (colon+1-_userinfo)));
|
||||||
|
Loading…
Reference in New Issue
Block a user