Merge pull request #4696 from owncloud/issue4573_negative_content_length

Discovery: Be more explicit about files with unknown size #4573
This commit is contained in:
Markus Goetz 2016-04-19 16:09:48 +02:00
commit edb942ba61
2 changed files with 12 additions and 3 deletions

View file

@ -309,6 +309,7 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
checksumIdentical = strncmp(st->checksum, tmp->checksum, 1000) == 0; checksumIdentical = strncmp(st->checksum, tmp->checksum, 1000) == 0;
} }
if (checksumIdentical) { 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->instruction = CSYNC_INSTRUCTION_NONE;
st->should_update_metadata = true; st->should_update_metadata = true;
goto out; goto out;
@ -555,7 +556,11 @@ int csync_walker(CSYNC *ctx, const char *file, const csync_vio_file_stat_t *fs,
switch (flag) { switch (flag) {
case CSYNC_FTW_FLAG_FILE: case CSYNC_FTW_FLAG_FILE:
if (ctx->current == REMOTE_REPLICA) { if (ctx->current == REMOTE_REPLICA) {
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); 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 { } else {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [inode=%" PRIu64 " size=%" PRIu64 "]", file, fs->inode, fs->size); CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [inode=%" PRIu64 " size=%" PRIu64 "]", file, fs->inode, fs->size);
} }

View 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->mtime = oc_httpdate_parse(value.toUtf8());
file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_MTIME; file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_MTIME;
} else if (property == "getcontentlength") { } else if (property == "getcontentlength") {
file_stat->size = value.toLongLong(); 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; file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE;
}
} else if (property == "getetag") { } else if (property == "getetag") {
file_stat->etag = csync_normalize_etag(value.toUtf8()); file_stat->etag = csync_normalize_etag(value.toUtf8());
file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_ETAG; file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_ETAG;