Skip to content

Commit

Permalink
basically try to enforce the windows compatibility as guess from server
Browse files Browse the repository at this point in the history
for now simple rule to guess if the server has windows naming enforced

if windows naming is enforced, we enforce it for new files

if not, we do not care

for now limited to spaces removal

more to come

Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed Feb 12, 2025
1 parent ae2eeeb commit 1056071
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libsync/discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent
const auto hasLeadingOrTrailingSpaces = excluded == CSYNC_FILE_EXCLUDE_LEADING_SPACE
|| excluded == CSYNC_FILE_EXCLUDE_TRAILING_SPACE
|| excluded == CSYNC_FILE_EXCLUDE_LEADING_AND_TRAILING_SPACE;
const auto leadingAndTrailingSpacesFilesAllowed = _discoveryData->_leadingAndTrailingSpacesFilesAllowed.contains(_discoveryData->_localDir + path);
const auto leadingAndTrailingSpacesFilesAllowed = !_discoveryData->_shouldEnforceWindowsFileNameCompatibility || _discoveryData->_leadingAndTrailingSpacesFilesAllowed.contains(_discoveryData->_localDir + path);
if (hasLeadingOrTrailingSpaces && (wasSyncedAlready || leadingAndTrailingSpacesFilesAllowed)) {
excluded = CSYNC_NOT_EXCLUDED;
}
Expand Down Expand Up @@ -470,6 +470,7 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent
}
item->_errorString = reasonString.isEmpty() ? errorString : QStringLiteral("%1 %2").arg(errorString, reasonString);
item->_status = SyncFileItem::FileNameInvalidOnServer;
maybeRenameForWindowsCompatibility(_discoveryData->_localDir + item->_file, excluded);
break;
}
}
Expand Down

0 comments on commit 1056071

Please sign in to comment.