Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-44242

QFileInfo::canonicalFilePath() returns wrong values when passed trailing slashes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.13.1, 5.14.0 Alpha
    • 5.4.0, 5.12.3
    • Core: I/O
    • None
    • Linux; macOS
    • bd55a9d91227d1ac38f51b21ca23dec7fa5e82af (qt/qtbase/5.13)

    Description

      When a QFileInfo object is constructed with a path that points to a file but has trailing slashes exists() returns false, but canonicalFilePath() returns the path with the trailing slashes instead of a empty string.

      This can be seen in the attached testcase:
      /usr/bin/ls: exists true, canonical "/usr/bin/ls"
      /usr/bin/ls/: exists false, canonical "/usr/bin/ls/"
      /usr/bin/ls///: exists false, canonical "/usr/bin/ls///"
      /usr/bin/doesnotexist: exists false, canonical ""

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vhilshei Volker Hilsheimer
            arichardson Alex Richardson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes