385 sstr_t hh = sstrn(href->space, href->size); |
385 sstr_t hh = sstrn(href->space, href->size); |
386 dav_session_cache_path(sn, pp, hh); |
386 dav_session_cache_path(sn, pp, hh); |
387 |
387 |
388 ucx_buffer_write(elm.ptr, 1, elm.length, pbuf); |
388 ucx_buffer_write(elm.ptr, 1, elm.length, pbuf); |
389 if(child) { |
389 if(child) { |
|
390 // href is already URL encoded, so don't encode again |
390 ucx_buffer_puts(href, util_resource_name(child->href)); |
391 ucx_buffer_puts(href, util_resource_name(child->href)); |
391 res = child; |
392 res = child; |
392 } else if(DAV_ENCRYPT_NAME(sn)) { |
393 } else if(DAV_ENCRYPT_NAME(sn)) { |
393 char *random_name = util_random_str(); |
394 char *random_name = util_random_str(); |
394 ucx_buffer_puts(href, random_name); |
395 ucx_buffer_puts(href, random_name); |
395 free(random_name); |
396 free(random_name); |
396 } else { |
397 } else { |
397 ucx_buffer_puts(href, util_resource_name(path)); |
398 // path is not URL encoded, so we have to do this here |
|
399 scstr_t resname = scstr(util_resource_name(path)); |
|
400 char *esc = curl_easy_escape(sn->handle, |
|
401 resname.ptr, resname.length); |
|
402 ucx_buffer_write(esc, 1, strlen(esc), href); |
|
403 curl_free(esc); |
398 } |
404 } |
399 } |
405 } |
400 |
406 |
401 // cleanup |
407 // cleanup |
402 free(elm.ptr); |
408 free(elm.ptr); |