Skip to content

KDirSelectDialog: handle local URLs ending with a space

Fabian Kosmale requested to merge urlWithSpace2 into master

QUrl::fromUserInput strips spaces, under the assumption that they are mostly stray spaces from copy pasting an URL. This is problematic when the file/folder under consideration actually ends with whitespace. This patch reaads the stripped spaces if a file with spaces actually exists. However, this is only done for local files, as the necesary synchronous stat would be to costly over a network.

Test plan:

  • Create folders with one (or more) whitespace characters
  • Run a test-program calling QFileDialog::getExistingDirectory (the one from QTBUG-81643 will do), and select the created folder by entering its path into the url combo box.
  • Observe that the returned QUrl now contains a space, as it should.

CCBUG: BKO-407671

Merge request reports