fixes DavSession creation in dav-sync when using root collection

Tue, 08 Jan 2019 16:37:13 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 08 Jan 2019 16:37:13 +0100
changeset 502
a23fedac340c
parent 501
868da3f76267
child 503
f84e64afee61

fixes DavSession creation in dav-sync when using root collection

dav/sync.c file | annotate | diff | comparison | revisions
--- a/dav/sync.c	Sun Dec 09 18:32:14 2018 +0100
+++ b/dav/sync.c	Tue Jan 08 16:37:13 2019 +0100
@@ -330,6 +330,12 @@
         url = util_concat_path(repo->url, collection);
         find_collection = FALSE;
     }
+    if(!collection || (collection[0] == '/' && strlen(collection) == 1)) {
+        // collection is NULL or "/"
+        // we don't need to find any collection because the repo url is
+        // the base url
+        find_collection = FALSE;
+    }
     DavSession *sn = dav_session_new_auth(
             ctx,
             url,
@@ -519,6 +525,11 @@
     int sync_delete = 0;
     int sync_error = 0;
     
+    UcxList *ls_get = NULL;
+    UcxList *ls_remove = NULL;
+    UcxList *ls_conflict = NULL;
+    UcxList *ls_broken = NULL;
+    
     UcxMap *svrres = ucx_map_new(db->resources->count);
     
     UcxList *statls = NULL;
@@ -560,6 +571,7 @@
             if(status && !strcmp(status, "broken")) {
                 res = res->next;
                 localres_keep(db, res->path);
+                ls_broken = ucx_list_append(ls_broken, res);
                 continue;
             }
             
@@ -667,6 +679,31 @@
     return ret;
 }
 
+int sync_remote_is_changed(
+        CmdArgs *a,
+        SyncDirectory *dir,
+        DavResource *res,
+        SyncDatabase *db,
+        DavBool force,
+        DavBool *conflict,
+        DavBool *metadataupdate)
+{
+    int cdt = cmd_getoption(a, "conflict") ? 0 : 1; // conflict detection
+    *conflict = 0;
+    *metadataupdate = 0;
+    
+    LocalResource *local = ucx_map_cstr_get(db->resources, res->path);
+    char *local_path = util_concat_path(dir->path, res->path);
+    
+    char *etag = dav_get_string_property(res, "D:getetag");
+    SYS_STAT s;
+    int ret = 0;
+    
+    
+    free(local_path);
+    return ret;
+}
+
 int sync_get_resource(
         CmdArgs *a,
         SyncDirectory *dir,

mercurial