Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Merge requests
!10830
Resolve
#3497796
"File download"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Resolve
#3497796
"File download"
issue/drupal-3497796:3497796-file-download
into
11.x
Overview
4
Commits
4
Pipelines
8
Changes
8
2 unresolved threads
Hide all comments
Open
Michael Strelan
requested to merge
issue/drupal-3497796:3497796-file-download
into
11.x
5 months ago
Overview
4
Commits
4
Pipelines
8
Changes
8
2 unresolved threads
Hide all comments
Expand
Closes
#3497796
0
0
Merge request reports
Compare
11.x
version 7
5ce1e2ed
4 months ago
version 6
827b171c
5 months ago
version 5
4517461e
5 months ago
version 4
aac002ee
5 months ago
version 3
9198be39
5 months ago
version 2
19ea6dc5
5 months ago
version 1
19d3b560
5 months ago
11.x (base)
and
latest version
latest version
e7b84f3b
4 commits,
4 months ago
version 7
5ce1e2ed
4 commits,
4 months ago
version 6
827b171c
6 commits,
5 months ago
version 5
4517461e
5 commits,
5 months ago
version 4
aac002ee
4 commits,
5 months ago
version 3
9198be39
3 commits,
5 months ago
version 2
19ea6dc5
2 commits,
5 months ago
version 1
19d3b560
2 commits,
5 months ago
8 files
+
16
−
42
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
core/lib/Drupal/Core/File/file.api.php
+
3
−
2
Options
@@ -23,7 +23,7 @@
* @param string $uri
* The URI of the file.
*
* @return string[]|int
* @return string[]|int
|null
* If the user does not have permission to access the file, return -1. If the
* user has permission, return an array with the appropriate headers. If the
* file is not controlled by the current module, the return value should be
@@ -31,7 +31,7 @@
*
* @see \Drupal\system\FileDownloadController::download()
*/
function
hook_file_download
(
$uri
)
{
function
hook_file_download
(
$uri
)
:
array
|
int
|
null
{
// Check to see if this is a config download.
$scheme
=
StreamWrapperManager
::
getScheme
(
$uri
);
$target
=
StreamWrapperManager
::
getTarget
(
$uri
);
@@ -40,6 +40,7 @@ function hook_file_download($uri) {
'Content-disposition'
=>
'attachment; filename="config.tar.gz"'
,
];
}
return
NULL
;
}
/**
Loading