Merge pull request #319 from nextcloud/upstream/issue/4424

Folder: normalize the local path.
This commit is contained in:
Roeland Jago Douma 2018-06-04 16:02:49 +02:00 committed by GitHub
commit c49597d9d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -122,6 +122,10 @@ void Folder::checkLocalPath()
{ {
const QFileInfo fi(_definition.localPath); const QFileInfo fi(_definition.localPath);
_canonicalLocalPath = fi.canonicalFilePath(); _canonicalLocalPath = fi.canonicalFilePath();
#ifdef Q_OS_MAC
// Workaround QTBUG-55896 (Should be fixed in Qt 5.8)
_canonicalLocalPath = _canonicalLocalPath.normalized(QString::NormalizationForm_C);
#endif
if (_canonicalLocalPath.isEmpty()) { if (_canonicalLocalPath.isEmpty()) {
qCWarning(lcFolder) << "Broken symlink:" << _definition.localPath; qCWarning(lcFolder) << "Broken symlink:" << _definition.localPath;
_canonicalLocalPath = _definition.localPath; _canonicalLocalPath = _definition.localPath;

View file

@ -517,8 +517,7 @@ bool OwncloudPropagator::localFileNameClash(const QString &relFile)
re = false; re = false;
qCWarning(lcPropagator) << "No valid fileinfo"; qCWarning(lcPropagator) << "No valid fileinfo";
} else { } else {
// Need to normalize to composited form because of // Need to normalize to composited form because of QTBUG-39622/QTBUG-55896
// https://bugreports.qt-project.org/browse/QTBUG-39622
const QString cName = fileInfo.canonicalFilePath().normalized(QString::NormalizationForm_C); const QString cName = fileInfo.canonicalFilePath().normalized(QString::NormalizationForm_C);
bool equal = (file == cName); bool equal = (file == cName);
re = (!equal && !cName.endsWith(relFile, Qt::CaseSensitive)); re = (!equal && !cName.endsWith(relFile, Qt::CaseSensitive));