]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Checksums: Skip uploads of .eml files only #4754
authorChristian Kamm <mail@ckamm.de>
Thu, 28 Apr 2016 10:43:06 +0000 (12:43 +0200)
committerChristian Kamm <mail@ckamm.de>
Thu, 28 Apr 2016 10:59:39 +0000 (12:59 +0200)
This is a workaround. A correct solution would still update file metadata
such as the mtime. See #4755.

csync/src/csync_misc.h
csync/src/csync_update.c
csync/tests/ownCloud/t9.pl

index 2769cbc74d4325622b9e0f387dba2c51af8022b8..783ef4dd509b6c5a1d96fff11a9a391be5d66c03 100644 (file)
@@ -33,6 +33,7 @@
  * than fmmatch anyway, which does not care for flags.
  **/
 #define FNM_PATHNAME    (1 << 0) /* No wildcard can ever match `/'.  */
+#define FNM_CASEFOLD    (1 << 4) /* Compare without regard to case.  */
 #endif
 
 int csync_fnmatch(__const char *__pattern, __const char *__name, int __flags);
index f5b010ef05c3c1769683bb34e7adc3203290c02d..f579bde8a13be41338b4a4cad9d4b4864fcd8827 100644 (file)
@@ -297,7 +297,10 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
                  // zero size in statedb can happen during migration
                  || (tmp->size != 0 && fs->size != tmp->size))) {
 
-            if (fs->size == tmp->size && tmp->checksumTypeId) {
+            // Checksum comparison at this stage is only enabled for .eml files,
+            // check #4754 #4755
+            bool isEmlFile = csync_fnmatch("*.eml", file, FNM_CASEFOLD) == 0;
+            if (isEmlFile && fs->size == tmp->size && tmp->checksumTypeId) {
                 if (ctx->callbacks.checksum_hook) {
                     st->checksum = ctx->callbacks.checksum_hook(
                                 file, tmp->checksumTypeId,
index adb655d1579f6c2f5c305b6f10c9616d670cef55..1fb738903184b4585da7ca3f1df50d5253beb65e 100755 (executable)
@@ -59,11 +59,12 @@ my $emlpropafter = remoteFileProp("", "test.eml");
 assert($txtpropafter);
 assert($emlpropafter);
 
-# The both files were not uploaded, nothing differs
-assert($txtpropafter->get_property( "getetag" ) eq
+# The txt file is uploaded normally, etag and mtime differ
+assert($txtpropafter->get_property( "getetag" ) ne
        $txtpropbefore->get_property( "getetag" ));
-assert($txtpropafter->get_property( "getlastmodified" ) eq
+assert($txtpropafter->get_property( "getlastmodified" ) ne
        $txtpropbefore->get_property( "getlastmodified" ));
+# The eml was not uploaded, nothing differs
 assert($emlpropafter->get_property( "getetag" ) eq
        $emlpropbefore->get_property( "getetag" ));
 assert($emlpropafter->get_property( "getlastmodified" ) eq