Convert the new filename to native separators before checking it
If a native separator was put in the new name when renaming a file name via the file dialog then it would correctly fail. But if a non-native one was used on Windows then it would cause the file to be moved instead if the directory existed. Change-Id: If01760b8c54a69b600c9a44c7509017be70d33e3 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
parent
eb95685556
commit
9ec493fa41
@ -850,7 +850,7 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
|
||||
return true;
|
||||
|
||||
if (newName.isEmpty()
|
||||
|| newName.contains(QDir::separator())
|
||||
|| QDir::toNativeSeparators(newName).contains(QDir::separator())
|
||||
|| !QDir(filePath(parent(idx))).rename(oldName, newName)) {
|
||||
#ifndef QT_NO_MESSAGEBOX
|
||||
QMessageBox::information(0, QFileSystemModel::tr("Invalid filename"),
|
||||
|
Loading…
Reference in New Issue
Block a user