Add error message for trailing spaces on Windows #4878

This commit is contained in:
Christian Kamm 2016-06-09 12:40:31 +02:00
parent 28c12a3ca0
commit 87b4693a9d
5 changed files with 13 additions and 2 deletions

View file

@ -98,6 +98,7 @@ enum csync_status_codes_e {
CSYNC_STATUS_INDIVIDUAL_IS_SYMLINK,
CSYNC_STATUS_INDIVIDUAL_IGNORE_LIST,
CSYNC_STATUS_INDIVIDUAL_IS_INVALID_CHARS,
CSYNC_STATUS_INDIVIDUAL_TRAILING_SPACE,
CSYNC_STATUS_INDIVIDUAL_EXCLUDE_LONG_FILENAME,
CYSNC_STATUS_FILE_LOCKED_OR_OPEN,
CSYNC_STATUS_INDIVIDUAL_EXCLUDE_HIDDEN,

View file

@ -229,8 +229,12 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(c_strlist_t *excludes, const ch
// distinguish files ending in '.' from files without an ending,
// as '.' is a separator that is not stored internally, so let's
// not allow to sync those to avoid file loss/ambiguities (#416)
if (blen > 1 && (bname[blen-1]== ' ' || bname[blen-1]== '.' )) {
match = CSYNC_FILE_EXCLUDE_INVALID_CHAR;
if (blen > 1) {
if (bname[blen-1]== ' ') {
match = CSYNC_FILE_EXCLUDE_TRAILING_SPACE;
} else if (bname[blen-1]== '.' ) {
match = CSYNC_FILE_EXCLUDE_INVALID_CHAR;
}
goto out;
}

View file

@ -27,6 +27,7 @@ enum csync_exclude_type_e {
CSYNC_FILE_EXCLUDE_AND_REMOVE,
CSYNC_FILE_EXCLUDE_LIST,
CSYNC_FILE_EXCLUDE_INVALID_CHAR,
CSYNC_FILE_EXCLUDE_TRAILING_SPACE,
CSYNC_FILE_EXCLUDE_LONG_FILENAME,
CSYNC_FILE_EXCLUDE_HIDDEN,
CSYNC_FILE_EXCLUDE_STAT_FAILED

View file

@ -477,6 +477,8 @@ out:
st->error_status = CSYNC_STATUS_INDIVIDUAL_IGNORE_LIST; /* File listed on ignore list. */
} else if (excluded == CSYNC_FILE_EXCLUDE_INVALID_CHAR) {
st->error_status = CSYNC_STATUS_INDIVIDUAL_IS_INVALID_CHARS; /* File contains invalid characters. */
} else if (excluded == CSYNC_FILE_EXCLUDE_TRAILING_SPACE) {
st->error_status = CSYNC_STATUS_INDIVIDUAL_TRAILING_SPACE; /* File ends with a trailing space. */
} else if (excluded == CSYNC_FILE_EXCLUDE_LONG_FILENAME) {
st->error_status = CSYNC_STATUS_INDIVIDUAL_EXCLUDE_LONG_FILENAME; /* File name is too long. */
} else if (excluded == CSYNC_FILE_EXCLUDE_HIDDEN ) {

View file

@ -437,6 +437,9 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
case CSYNC_STATUS_INDIVIDUAL_IS_INVALID_CHARS:
item->_errorString = tr("Filename contains invalid characters that can not be synced cross platform.");
break;
case CSYNC_STATUS_INDIVIDUAL_TRAILING_SPACE:
item->_errorString = tr("Filename contains trailing spaces.");
break;
case CSYNC_STATUS_INDIVIDUAL_EXCLUDE_LONG_FILENAME:
item->_errorString = tr("Filename is too long.");
break;