Browse Source

Use csync_normalize_etag everywhere.

Technically, we don't need to strip '-gzip' from the etag comming from
the propfind, but it is better to be consistant.
Olivier Goffart 12 years ago
parent
commit
1b4e2becb3
4 changed files with 3 additions and 17 deletions
  1. 0 1
      src/csync_misc.c
  2. 1 7
      src/csync_owncloud.c
  3. 1 7
      src/csync_owncloud_recursive_propfind.c
  4. 1 2
      src/csync_statedb.c

+ 0 - 1
src/csync_misc.c

@@ -264,7 +264,6 @@ CSYNC_STATUS csync_errno_to_status(int error, CSYNC_STATUS default_status)
 /* Remove possible quotes, and also the -gzip at the end
  * Remove "-gzip" at the end (cf. https://github.com/owncloud/mirall/issues/1195)
  * The caller must take ownership of the resulting string.
- * (work in place)
  */
 char *csync_normalize_etag(const char *etag)
 {

+ 1 - 7
src/csync_owncloud.c

@@ -621,13 +621,7 @@ static void results(void *userdata,
     }
 
     if( md5sum ) {
-        int len = strlen(md5sum)-2;
-        if( len > 0 ) {
-            /* Skip the " around the string coming back from the ne_propset_value call */
-            newres->md5 = c_malloc(len+1);
-            strncpy( newres->md5, md5sum+1, len );
-            newres->md5[len] = '\0';
-        }
+        newres->md5 = csync_normalize_etag(md5sum);
     }
 
     csync_vio_set_file_id(newres->file_id, file_id);

+ 1 - 7
src/csync_owncloud_recursive_propfind.c

@@ -185,13 +185,7 @@ static void propfind_results_recursive(void *userdata,
     }
 
     if( md5sum ) {
-        int len = strlen(md5sum)-2;
-        if( len > 0 ) {
-            /* Skip the " around the string coming back from the ne_propset_value call */
-            newres->md5 = c_malloc(len+1);
-            strncpy( newres->md5, md5sum+1, len );
-            newres->md5[len] = '\0';
-        }
+        newres->md5 = csync_normalize_etag(md5sum);
     }
 
     csync_vio_set_file_id(newres->file_id, file_id);

+ 1 - 2
src/csync_statedb.c

@@ -550,8 +550,7 @@ char *csync_statedb_get_uniqId( CSYNC *ctx, uint64_t jHash, csync_vio_file_stat_
     }
 
     if (result->count == 2) {
-        /* phash, pathlen, path, inode, uid, gid, mode, modtime */
-        ret = c_strdup( result->vector[0] );
+        ret = csync_normalize_etag( result->vector[0] );
         csync_vio_file_stat_set_file_id(buf, result->vector[1]);
     }