]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Discovery: Be more explicit about files with unknown size #4573
authorMarkus Goetz <markus@woboq.com>
Mon, 18 Apr 2016 15:33:25 +0000 (17:33 +0200)
committerMarkus Goetz <markus@woboq.com>
Tue, 19 Apr 2016 13:31:16 +0000 (15:31 +0200)
Also related https://github.com/owncloud/core/issues/23468

csync/src/csync_update.c
src/libsync/discoveryphase.cpp

index 88cfe023e03c4658e3c0c697d0a1b771879966f0..f5b010ef05c3c1769683bb34e7adc3203290c02d 100644 (file)
@@ -309,6 +309,7 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
                     checksumIdentical = strncmp(st->checksum, tmp->checksum, 1000) == 0;
                 }
                 if (checksumIdentical) {
+                    CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "NOTE: Checksums are identical, file did not actually change: %s", path);
                     st->instruction = CSYNC_INSTRUCTION_NONE;
                     st->should_update_metadata = true;
                     goto out;
@@ -555,7 +556,11 @@ int csync_walker(CSYNC *ctx, const char *file, const csync_vio_file_stat_t *fs,
   switch (flag) {
     case CSYNC_FTW_FLAG_FILE:
       if (ctx->current == REMOTE_REPLICA) {
-        CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s size=%" PRIu64 "]", file, fs->file_id, fs->size);
+          if (fs->fields & CSYNC_VIO_FILE_STAT_FIELDS_SIZE) {
+              CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s size=%" PRIu64 "]", file, fs->file_id, fs->size);
+          } else {
+              CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s size=UNKNOWN]", file, fs->file_id);
+          }
       } else {
           CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [inode=%" PRIu64 " size=%" PRIu64 "]", file, fs->inode, fs->size);
       }
index 29b4c223ea8f4f2c903bdfdc408c75ad8461d5e9..c85fe2d3c4141ae6e4d02175aae3070a3d40f0c9 100644 (file)
@@ -258,8 +258,12 @@ static csync_vio_file_stat_t* propertyMapToFileStat(const QMap<QString,QString>
             file_stat->mtime = oc_httpdate_parse(value.toUtf8());
             file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_MTIME;
         } else if (property == "getcontentlength") {
-            file_stat->size = value.toLongLong();
-            file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE;
+            bool ok = false;
+            qlonglong ll = value.toLongLong(&ok);
+            if (ok && ll >= 0) {
+                file_stat->size = ll;
+                file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE;
+            }
         } else if (property == "getetag") {
             file_stat->etag = csync_normalize_etag(value.toUtf8());
             file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_ETAG;