Sun, 09 Nov 2014 14:33:23 +0100
some bug fixes
dav/scfg.c | file | annotate | diff | comparison | revisions | |
dav/sync.c | file | annotate | diff | comparison | revisions | |
libidav/methods.c | file | annotate | diff | comparison | revisions | |
libidav/utils.c | file | annotate | diff | comparison | revisions | |
libidav/utils.h | file | annotate | diff | comparison | revisions | |
libidav/webdav.c | file | annotate | diff | comparison | revisions |
--- a/dav/scfg.c Sun Nov 09 11:30:24 2014 +0100 +++ b/dav/scfg.c Sun Nov 09 14:33:23 2014 +0100 @@ -160,7 +160,8 @@ regcomp(matchnothing, "///", REG_NOSUB); dir->exclude = ucx_list_append(NULL, matchnothing); } - if (trash) { + + if (trash && sstrtrim(sstr(trash)).length > 0) { if (trash[0] == '/') { dir->trash = strdup(trash); } else { @@ -176,6 +177,8 @@ fprintf(stderr, "Cannot create trash directory.\n"); } } + } else { + dir->trash = NULL; } ucx_map_cstr_put(directories, name, dir);
--- a/dav/sync.c Sun Nov 09 11:30:24 2014 +0100 +++ b/dav/sync.c Sun Nov 09 14:33:23 2014 +0100 @@ -501,8 +501,10 @@ UcxMapIterator i = ucx_map_iterator(db->resources); LocalResource *local; UCX_MAP_FOREACH(key, local, i) { - if(sync_delete_remote_resource(sn, local)) { - ucx_map_cstr_put(lclres, local->path, local); + if (!res_matches_filter(dir, local->path+1)) { + if(sync_delete_remote_resource(sn, local)) { + ucx_map_cstr_put(lclres, local->path, local); + } } } ucx_map_free(db->resources); @@ -720,7 +722,7 @@ } int ret = 0; - if(!strcmp(etag, local_res->etag)) { + if(etag && !strcmp(etag, local_res->etag)) { // local resource metadata == remote resource metadata // resource can be deleted printf("delete: %s\n", res->path);
--- a/libidav/methods.c Sun Nov 09 11:30:24 2014 +0100 +++ b/libidav/methods.c Sun Nov 09 14:33:23 2014 +0100 @@ -280,8 +280,8 @@ //char *href = (char*)href_node->content; href = util_url_path((char*)href_node->content); - sstr_t href_s = sstr((char*)href); - sstr_t href_r = sstr(resource->href); + sstr_t href_s = sstr(util_url_decode(resource->session, href)); + sstr_t href_r = sstr(util_url_decode(resource->session, resource->href)); if(!sstrcmp(href_s, href_r)) { res = resource; } else if(href_s.length == href_r.length + 1) { @@ -292,6 +292,9 @@ } } } + + free(href_s.ptr); + free(href_r.ptr); } else if(xstreq(node->name, "propstat")) { xmlNode *n = node->children; xmlNode *prop_node = NULL;
--- a/libidav/utils.c Sun Nov 09 11:30:24 2014 +0100 +++ b/libidav/utils.c Sun Nov 09 14:33:23 2014 +0100 @@ -110,6 +110,13 @@ return path; } +char* util_url_decode(DavSession *sn, char *url) { + char *unesc = curl_easy_unescape(sn->handle, url, strlen(url), NULL); + char *ret = strdup(unesc); + curl_free(unesc); + return ret; +} + char* util_resource_name(char *url) { int si = 0; int osi = 0;
--- a/libidav/utils.h Sun Nov 09 11:30:24 2014 +0100 +++ b/libidav/utils.h Sun Nov 09 14:33:23 2014 +0100 @@ -59,6 +59,7 @@ int util_mkdir(char *path, mode_t mode); char* util_url_path(char *url); +char* util_url_decode(DavSession *sn, char *url); char* util_resource_name(char *url); char* util_concat_path(char *url_base, char *path); void util_set_url(DavSession *sn, char *href);