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

Wrong suggested filename with data: URLs

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.15.4
    • 5.12.10, 5.15.3
    • WebEngine
    • None
    • a134b801dc38feb536d4829213624dba72702d54 (qt/qtwebengine/5.15)

    Description

      Consider this test page:

      <!DOCTYPE html>
      <html>
          <head>
              <meta charset="utf-8">
              <title>data: link</title>
          </head>
          <body>
              <a href="data:application/gzip;base64,dGVzdA==">data URL without slash</a><br/>
              <a href="data:application/gzip;base64,dGVzdCA/IHRlc3Q=">data URL with slash</a><br/>
              <a href="data:application/gzip;base64,dGVzdCA/IHRlc3Q=" download="filename.gz">data URL with filename</a><br/>
          </body>
      </html>
      

      Also hosted here for convenience: https://qutebrowser.org/tmp/data-url.html

      When clicking the first two links in Chromium, they get downloaded as "download.gz", which seems like a reasonable filename considering that we only know the mimetype.

      When doing the same with simplebrowser, they get named "gzip" and "IHRlc3Q=", i.e. whatever the part after the last slash in the data URL is. In real-world scenarios, this can cause downloads to fail (unless the user overrides the filename) because the filename is longer than what the filesystem supports.

      Unfortunately, this can't be easily worked around by checking whether the URL is a data URL and overriding Qt's suggestion, because a webpage can suggest a filename to use (in which case Qt is doing the proper thing) - as shown by the third example.

      Attachments

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

        Activity

          People

            qt_webengine_team Qt WebEngine Team
            the compiler Florian Bruhin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes