mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
Merge conflicts solved.
This commit is contained in:
parent
ae5394ad75
commit
0618eb956d
3 changed files with 63 additions and 15 deletions
|
@ -597,7 +597,6 @@ static void results(void *userdata,
|
|||
if( md5sum ) {
|
||||
/* Skip the " around the string coming back from teh ne_propset_value call */
|
||||
strncpy( newres->md5, md5sum+1, 32 );
|
||||
DEBUG_WEBDAV("OOOOOOOOOOOOOOOOOOOOO %s", newres->md5);
|
||||
}
|
||||
|
||||
/* prepend the new resource to the result list */
|
||||
|
@ -712,7 +711,6 @@ static csync_vio_file_stat_t *resourceToFileStat( struct resource *res )
|
|||
lfs->size = res->size;
|
||||
lfs->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE;
|
||||
lfs->md5 = c_strdup(res->md5);
|
||||
DEBUG_WEBDAV("XXXXXXXXXXXXXXXXXXXXX MD5: %s", lfs->md5 );
|
||||
lfs->fields |= CSYNC_VIO_FILE_STAT_FIELDS_MD5;
|
||||
return lfs;
|
||||
}
|
||||
|
@ -809,6 +807,7 @@ static int owncloud_stat(const char *uri, csync_vio_file_stat_t *buf) {
|
|||
* stat. If the cache matches, a http call is saved.
|
||||
*/
|
||||
if( _fs.name && strcmp( buf->name, _fs.name ) == 0 ) {
|
||||
|
||||
buf->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE;
|
||||
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE;
|
||||
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE;
|
||||
|
@ -820,10 +819,11 @@ static int owncloud_stat(const char *uri, csync_vio_file_stat_t *buf) {
|
|||
buf->type = _fs.type;
|
||||
buf->mtime = _fs.mtime;
|
||||
buf->md5 = c_strdup( _fs.md5 );
|
||||
|
||||
DEBUG_WEBDAV("stat results from fs cache - md5: %s", _fs.md5);
|
||||
buf->size = _fs.size;
|
||||
buf->mode = _stat_perms( _fs.type );
|
||||
} else if( _statCache.uri && c_streq( _statCache.uri, uri )) {
|
||||
DEBUG_WEBDAV("stat results from stat cache");
|
||||
DEBUG_WEBDAV("Found file stat info in statcache!");
|
||||
buf->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE;
|
||||
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE;
|
||||
|
@ -832,13 +832,14 @@ static int owncloud_stat(const char *uri, csync_vio_file_stat_t *buf) {
|
|||
// buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_PERMISSIONS;
|
||||
buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_MD5;
|
||||
|
||||
buf->type = _fs.type;
|
||||
buf->size = _fs.size;
|
||||
buf->md5 = c_strdup( _fs.md5 );
|
||||
buf->type = _statCache.stat.type;
|
||||
buf->size = _statCache.stat.size;
|
||||
buf->md5 = c_strdup( _statCache.stat.md5 );
|
||||
|
||||
// buf->mode = _stat_perms( _fs.type );
|
||||
// buf->mode = _stat_perms( _statCache.type );
|
||||
|
||||
} else {
|
||||
DEBUG_WEBDAV("stat results fetched.");
|
||||
/* fetch data via a propfind call. */
|
||||
fetchCtx = c_malloc( sizeof( struct listdir_context ));
|
||||
if( ! fetchCtx ) {
|
||||
|
@ -906,16 +907,17 @@ static int owncloud_stat(const char *uri, csync_vio_file_stat_t *buf) {
|
|||
buf->mtime = lfs->mtime;
|
||||
buf->size = lfs->size;
|
||||
buf->mode = _stat_perms( lfs->type );
|
||||
buf->md5 = c_strdup( lfs->md5 );
|
||||
|
||||
buf->md5 = c_strdup( lfs->md5 );
|
||||
DEBUG_WEBDAV("XXXXXXXXXXXXXXX md5: %s", buf->md5 );
|
||||
csync_vio_file_stat_destroy( lfs );
|
||||
}
|
||||
|
||||
free_fetchCtx( fetchCtx );
|
||||
}
|
||||
}
|
||||
DEBUG_WEBDAV("STAT result: %s, type=%d", buf->name ? buf->name:"NULL",
|
||||
buf->type );
|
||||
DEBUG_WEBDAV("STAT result: %s, md5: %s", buf->name ? buf->name:"NULL",
|
||||
buf->md5 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1553,7 +1555,7 @@ static csync_vio_file_stat_t *owncloud_readdir(csync_vio_method_handle_t *dhandl
|
|||
_fs.fields = lfs->fields;
|
||||
_fs.type = lfs->type;
|
||||
_fs.size = lfs->size;
|
||||
_fs.md5 = lfs->md5;
|
||||
_fs.md5 = c_strdup(lfs->md5);
|
||||
}
|
||||
|
||||
/* DEBUG_WEBDAV("LFS fields: %s: %d", lfs->name, lfs->type ); */
|
||||
|
|
|
@ -56,6 +56,34 @@ static bool _push_to_tmp_first(CSYNC *ctx)
|
|||
return false;
|
||||
}
|
||||
|
||||
static char*_get_md5( CSYNC *ctx, const char *uri ) {
|
||||
char errbuf[256] = {0};
|
||||
csync_vio_file_stat_t *tstat = NULL;
|
||||
char *md5 = NULL;
|
||||
|
||||
tstat = csync_vio_file_stat_new();
|
||||
if (tstat == NULL) {
|
||||
strerror_r(errno, errbuf, sizeof(errbuf));
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR,
|
||||
"file: %s, command: stat, error: %s",
|
||||
uri,
|
||||
errbuf);
|
||||
}
|
||||
if ( tstat && csync_vio_stat(ctx, uri, tstat) < 0) {
|
||||
strerror_r(errno, errbuf, sizeof(errbuf));
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR,
|
||||
"file: %s, command: stat(for md5), error: %s",
|
||||
uri,
|
||||
errbuf);
|
||||
} else {
|
||||
md5 = c_strdup(tstat->md5);
|
||||
}
|
||||
SAFE_FREE(tstat);
|
||||
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Final MD5 for %s: %s", uri, md5 ? md5 : "<null>");
|
||||
return md5;
|
||||
}
|
||||
|
||||
static int _csync_push_file(CSYNC *ctx, csync_file_stat_t *st) {
|
||||
enum csync_replica_e srep = -1;
|
||||
enum csync_replica_e drep = -1;
|
||||
|
@ -332,12 +360,18 @@ static int _csync_push_file(CSYNC *ctx, csync_file_stat_t *st) {
|
|||
rc = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if( st->md5 ) {
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "UUUU MD5 sum: %s", st->md5);
|
||||
} else {
|
||||
if( tstat->md5 ) {
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "Target MD5 sum is %s", tstat->md5 );
|
||||
st->md5 = c_strdup(tstat->md5 );
|
||||
} else {
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "MD5 sum is empty");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (_push_to_tmp_first(ctx)) {
|
||||
|
@ -392,6 +426,11 @@ static int _csync_push_file(CSYNC *ctx, csync_file_stat_t *st) {
|
|||
ctx->replica = drep;
|
||||
csync_vio_utimes(ctx, duri, times);
|
||||
|
||||
/* do a stat on the target again to get a valid md5 */
|
||||
// if( ! st->md5 ) {
|
||||
st->md5 = _get_md5( ctx, turi );
|
||||
// }
|
||||
|
||||
/* set instruction for the statedb merger */
|
||||
st->instruction = CSYNC_INSTRUCTION_UPDATED;
|
||||
|
||||
|
@ -781,6 +820,9 @@ static int _csync_new_dir(CSYNC *ctx, csync_file_stat_t *st) {
|
|||
|
||||
csync_vio_utimes(ctx, uri, times);
|
||||
|
||||
// if( ! st->md5 )
|
||||
st->md5 = _get_md5(ctx, uri);
|
||||
|
||||
/* set instruction for the statedb merger */
|
||||
st->instruction = CSYNC_INSTRUCTION_UPDATED;
|
||||
|
||||
|
@ -857,7 +899,9 @@ static int _csync_sync_dir(CSYNC *ctx, csync_file_stat_t *st) {
|
|||
times[0].tv_usec = times[1].tv_usec = 0;
|
||||
|
||||
csync_vio_utimes(ctx, uri, times);
|
||||
|
||||
// if( ! st->md5 ) {
|
||||
st->md5 = _get_md5(ctx, uri);
|
||||
// }
|
||||
/* set instruction for the statedb merger */
|
||||
st->instruction = CSYNC_INSTRUCTION_UPDATED;
|
||||
|
||||
|
|
|
@ -424,7 +424,8 @@ csync_file_stat_t *csync_statedb_get_stat_by_hash(CSYNC *ctx, uint64_t phash) {
|
|||
st->gid = atoi(result->vector[5]);
|
||||
st->mode = atoi(result->vector[6]);
|
||||
st->modtime = strtoul(result->vector[7], NULL, 10);
|
||||
st->md5 = c_strdup( result->vector[8] );
|
||||
if( result->vector[8])
|
||||
st->md5 = c_strdup( result->vector[8] );
|
||||
c_strlist_destroy(result);
|
||||
|
||||
return st;
|
||||
|
@ -469,7 +470,8 @@ csync_file_stat_t *csync_statedb_get_stat_by_inode(CSYNC *ctx, uint64_t inode) {
|
|||
st->gid = atoi(result->vector[5]);
|
||||
st->mode = atoi(result->vector[6]);
|
||||
st->modtime = strtoul(result->vector[7], NULL, 10);
|
||||
st->md5 = c_strdup(result->vector[8]);
|
||||
if( result->vector[8] )
|
||||
st->md5 = c_strdup(result->vector[8]);
|
||||
|
||||
c_strlist_destroy(result);
|
||||
|
||||
|
|
Loading…
Reference in a new issue