don't store directories with a trailing path separator in the sync db

Tue, 09 Apr 2024 21:28:24 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 09 Apr 2024 21:28:24 +0200
changeset 810
baf199df500e
parent 809
8e6d8f0327cf
child 811
9385330bdd38

don't store directories with a trailing path separator in the sync db

dav/sync.c file | annotate | diff | comparison | revisions
--- a/dav/sync.c	Sun Apr 07 10:26:25 2024 +0200
+++ b/dav/sync.c	Tue Apr 09 21:28:24 2024 +0200
@@ -840,7 +840,7 @@
         DavResource *res = cxListAt(stack, 0);
         cxListRemove(stack, 0);
          
-        while(res) {
+        while(res) {        
             DavBool res_filtered = FALSE;
             if (res_matches_dir_filter(dir, res->path)) {
                 res_filtered = TRUE;
@@ -1084,7 +1084,6 @@
     
     CxList *rmdirs = cxLinkedListCreate(cxDefaultAllocator, (cx_compare_func)resource_pathlen_cmp, CX_STORE_POINTERS);
     i = cxMapIteratorValues(lres_removed);
-    LocalResource *removed_res;
     cx_foreach(LocalResource *, removed_res, i) {
         if(sync_shutdown) {
             break;
@@ -2184,7 +2183,7 @@
             }
         }
         
-        
+       
         // we need a fast file lookup map later to detect deleted files
         cxMapPut(resources_map, cx_hash_key_str(local_res->path), local_res);
         
@@ -3075,11 +3074,12 @@
     res->uid = s.st_uid;
     res->gid = s.st_gid;
     res->last_modified = s.st_mtime;
+    res->path = strdup(path);
     if(!S_ISDIR(s.st_mode)) {
-        res->path = strdup(path);
+        //res->path = strdup(path);
         res->size = s.st_size;
     } else {
-        res->path = util_concat_path(path, "/");
+        //res->path = util_concat_path(path, "/");
         res->isdirectory = 1;
     }
     

mercurial