From fce58ba7985cc2142d1bba0d90b73e507aea67f4 Mon Sep 17 00:00:00 2001 From: Chris MacDonald <31731869+chrismacdonaldw@users.noreply.github.com> Date: Fri, 20 Oct 2023 15:47:44 -0300 Subject: [PATCH 1/3] Ensure correct filename --- foxml.module | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/foxml.module b/foxml.module index 3bcd16e..b289879 100644 --- a/foxml.module +++ b/foxml.module @@ -5,6 +5,8 @@ * General hook implementations. */ + + /** * Implements hook_file_download(). */ @@ -27,11 +29,14 @@ function foxml_file_download(string $uri) { return $user->hasPermission('access referenced foxml') ? [ 'Cache-Control' => 'private', - ] : + ] + $headers : -1; } else { - // Assume that file_file_download() will handle it. - return NULL; + $file_name = $file->getFileName(); + + return [ + 'Content-Disposition' => 'attachment; filename="' . $file_name . '"', + ]; } } From 859f0ca59617b661bb61c42380a97bc7b93b39f1 Mon Sep 17 00:00:00 2001 From: Chris MacDonald <31731869+chrismacdonaldw@users.noreply.github.com> Date: Fri, 20 Oct 2023 15:48:29 -0300 Subject: [PATCH 2/3] Remove accidental header --- foxml.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foxml.module b/foxml.module index b289879..e896dde 100644 --- a/foxml.module +++ b/foxml.module @@ -29,7 +29,7 @@ function foxml_file_download(string $uri) { return $user->hasPermission('access referenced foxml') ? [ 'Cache-Control' => 'private', - ] + $headers : + ] : -1; } else { From 89ba6e3f729c17725dbdb3697783a21ce499ff69 Mon Sep 17 00:00:00 2001 From: Chris MacDonald <31731869+chrismacdonaldw@users.noreply.github.com> Date: Fri, 20 Oct 2023 15:48:51 -0300 Subject: [PATCH 3/3] Remove extra newlines --- foxml.module | 2 -- 1 file changed, 2 deletions(-) diff --git a/foxml.module b/foxml.module index e896dde..7761315 100644 --- a/foxml.module +++ b/foxml.module @@ -5,8 +5,6 @@ * General hook implementations. */ - - /** * Implements hook_file_download(). */