summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetaobject.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2024-10-28 18:06:48 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2024-10-29 18:42:01 +0100
commit53df22b42d73dbb48bc25ad05500993df56b928c (patch)
tree65be94d9bdca170539a4733f2c3b91726d65ce3d /src/corelib/kernel/qmetaobject.cpp
parent9d839dcebd02ee6da391e4239e91fc7b298f0cff (diff)
QFileSystemModel on Windows: consistently trim spaces and dots
On Windows, file- and directory-names that end with a space (or a dot) are invalid, even though it's possible to create them. Same for names that start with a space (but starting with dots is ok). Even Explorer chokes when trying to then delete or rename such a file or directory, and often the only way out of the mess is to operate on the 8.3 path. In Qt, we only sometimes fixed such paths by removing trailing spaces and dots. This still made it possible to create a "bad " directory in a non-native file dialog, which could then not be deleted. The node tree even ended up with both "bad " and "bad", neither of which was handled correctly. Fix this by always chopping trailing space and dots when adding or modifying a node, amending 3693d3d2a1e76f6e6d41db340505e00c6ddaeda1. Fortunately, this can be reproduced with QFileSystemModel, so add a test that exercises it in the same way as QFileDialog does, e.g. both by creating the misnamed directory directly, and by renaming a directory to an invalid name. Given that this is very broken on Windows Explorer as well, don't cherry-pick this back into branches under strict change management. Fixes: QTBUG-129028 Pick-to: 6.8 Change-Id: Iec1edf9fd2548dda4567134a9b5cf3e298589c19 Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/corelib/kernel/qmetaobject.cpp')
0 files changed, 0 insertions, 0 deletions