Details
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.