add missing isdirectory tag in db on pull

Sat, 10 Aug 2019 19:34:49 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 10 Aug 2019 19:34:49 +0200
changeset 616
0b61755f2852
parent 615
ab669d21f82a
child 617
1c995e93bf40

add missing isdirectory tag in db on pull

dav/sync.c file | annotate | diff | comparison | revisions
--- a/dav/sync.c	Sat Aug 10 19:18:29 2019 +0200
+++ b/dav/sync.c	Sat Aug 10 19:34:49 2019 +0200
@@ -951,6 +951,7 @@
     if(issplit) {
         util_remove_trailing_pathseparator(res->path);
     }
+    DavBool iscollection = res->iscollection && !issplit;
     
     RemoteChangeType type = cmd_getoption(a, "conflict") ?
             REMOTE_CHANGE_MODIFIED : REMOTE_CHANGE_CONFLICT_LOCAL_MODIFIED;
@@ -973,9 +974,14 @@
     }
     
     RemoteChangeType ret = REMOTE_NO_CHANGE;
-    if(res->iscollection && !issplit) {
+    if(iscollection) {
         if(!exists) {
             ret = REMOTE_CHANGE_MKDIR;
+        } else if(local && S_ISDIR(s.st_mode)) {
+            local->isdirectory = 1; // make sure isdirectory is set
+        } else {
+            // TODO: conflict
+            ret = REMOTE_NO_CHANGE;
         }
     } else if(local) {
         DavBool nochange = FALSE;

mercurial