Download link should contain filename

Created on 13 July 2020, over 4 years ago
Updated 25 June 2024, 8 months ago

If you download file immediately, then everything works fine, because correct headers are send. However, when you click the link, then no headers are send therefore filename is just `files` in my case. This can be fixed by adding value with required filename to download property of A element.

Note: I wasn't able to simulate this issue on Mac, only Linux (Ubuntu) and Windows - multiple browsers on both.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia mirom

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom steven jones

    Approach seems sensible, but I'm not sure about the exact implementation:

    +++ b/src/Plugin/views/display/DataExport.php
    @@ -898,13 +898,14 @@ class DataExport extends RestExport {
    +        $filename = basename($url);
    

    Is it valid to call basename on a URL?

    Seems like this might be working slightly by accident? Is it possible that this URL would contain a / that would trip it up?

  • Status changed to Needs work about 1 month ago
  • πŸ‡¬πŸ‡§United Kingdom steven jones

    Needs work as per #7

Production build 0.71.5 2024