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
Commits
5ae1aca2
Commit
5ae1aca2
authored
12 years ago
by
Larry Garfield
Committed by
Alex Bronstein
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove unnecessary files.
parent
0703718b
Loading
Loading
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/system/lib/Drupal/system/FileDownload.php
+0
-54
0 additions, 54 deletions
core/modules/system/lib/Drupal/system/FileDownload.php
core/vendor/Routing
+0
-1
0 additions, 1 deletion
core/vendor/Routing
with
0 additions
and
55 deletions
core/modules/system/lib/Drupal/system/FileDownload.php
deleted
100644 → 0
+
0
−
54
View file @
0703718b
<?php
namespace
Drupal\system
;
use
Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
/**
* Controller class for private file downloads.
*/
class
FileDownload
{
/**
* Page callback: Handles private file transfers.
*
* Call modules that implement hook_file_download() to find out if a file is
* accessible and what headers it should be transferred with. If one or more
* modules returned headers the download will start with the returned headers.
* If a module returns -1 an AccessDeniedHttpException will be thrown.
* If the file exists but no modules responded an AccessDeniedHttpException will
* be thrown.If the file does not exist a NotFoundHttpException will be thrown.
*
* @see hook_file_download()
*/
public
function
download
()
{
// Merge remaining path arguments into relative file path.
$args
=
func_get_args
();
$scheme
=
array_shift
(
$args
);
$target
=
implode
(
'/'
,
$args
);
$uri
=
$scheme
.
'://'
.
$target
;
if
(
file_stream_wrapper_valid_scheme
(
$scheme
)
&&
file_exists
(
$uri
))
{
// Let other modules provide headers and controls access to the file.
// module_invoke_all() uses array_merge_recursive() which merges header
// values into a new array. To avoid that and allow modules to override
// headers instead, use array_merge() to merge the returned arrays.
$headers
=
array
();
foreach
(
module_implements
(
'file_download'
)
as
$module
)
{
$function
=
$module
.
'_file_download'
;
$result
=
$function
(
$uri
);
if
(
$result
==
-
1
)
{
throw
new
AccessDeniedHttpException
();
}
if
(
isset
(
$result
)
&&
is_array
(
$result
))
{
$headers
=
array_merge
(
$headers
,
$result
);
}
}
if
(
count
(
$headers
))
{
return
file_transfer
(
$uri
,
$headers
);
}
throw
new
AccessDeniedHttpException
();
}
throw
new
NotFoundHttpException
();
}
}
This diff is collapsed.
Click to expand it.
Routing
@
a05bcaaa
Subproject commit a05bcaaaa43025037a0667e158aed9b65a147e80
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment