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

QWebEngineDownloadItem::path uses native separators when the file already exists

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Fixed
    • Affects Version/s: 5.12.1
    • Fix Version/s: 5.12.3, 5.13.0 Beta2
    • Component/s: WebEngine
    • Labels:
      None
    • Platform/s:
      Windows
    • Commits:
      a4deceac006cadf46123b07526e63750d44f0849 293c925a4f7500865089f23760fa46ed11585c4c

      Description

      The path returned by QWebEngineDownloadItem::path() contains native separators ('\' on Windows) instead of the standardized '/' used in Qt.

      For instance the following code

      connect(profile, &QWebEngineProfile::downloadRequested,
              this, [this](QWebEngineDownloadItem *dl) {
      		qDebug() << "Download request:" << dl->path();
      	});
      

      will generate the following output

      Download request: "C:\\Users\\User\\Downloads\\downloaded_file (1).ext"
      

      while I was expecting

      Download request: "C:/Users/User/Downloads/downloaded_file (1).ext"
      

      This happens only when there is already a file with the same name in the download folder and the file must be renamed with a number.

      On the first download path will be C:/Users/User/Downloads/downloaded_file.ext, but for the second download it will be C:\Users\User\Downloads\downloaded_file (1).ext.

        Attachments

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

          Activity

            People

            • Assignee:
              pvarga Peter Varga
              Reporter:
              bterrier Benjamin Terrier
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes