How to keep the file name unchanged

Created on 1 February 2023, almost 2 years ago
Updated 3 February 2023, almost 2 years ago

The download link is encrypted, but the file name is also renamed as the download link.

Example:

URL /system/files/%24%24/ZG93bmxvYWRzLzIwMTktTENBLVNwYW5pc2hfMTlMQ0FTUEEuemlw

FILE DOWNLOADED: ZG93bmxvYWRzLzIwMTktTENBLVNwYW5pc2hfMTlMQ0FTUEEuemlw.zip

Is it possible to keep the filename unchanged ?

PS. Thank you for this module.

💬 Support request
Status

Needs review

Version

2.0

Component

Miscellaneous

Created by

🇵🇱Poland adpo

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

Comments & Activities

  • Issue created by @adpo
  • 🇪🇸Spain dcimorra 🇪🇸 Spain

    A temporary solution could be to implement the hook_alter_file_uri which implements the EncryptedFileDownloadController handler to modify the headers that are returned, including the correct file name in them.

    However, I take note of this to change it.
    Thank you!

  • Assigned to dcimorra
  • 🇪🇸Spain dcimorra 🇪🇸 Spain
  • 🇵🇱Poland adpo

    Great, that worked. THank you

    function module_alter_file_uri(&$uri, $queryParams, &$headers, $scheme) {
      $headers["Content-Disposition"] = 'inline; filename="'.basename($uri).'"';
    }
  • @dcimorra opened merge request.
  • Status changed to Needs review almost 2 years ago
  • 🇪🇸Spain dcimorra 🇪🇸 Spain

    Marked as need's review, merged with 2.x-dev branch.

Production build 0.71.5 2024