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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
afeed9ed
Commit
afeed9ed
authored
Jan 30, 2013
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1890754
by Heine, pwolanin, tim.plunkett, Berdir: Fixed Private Images visible by url.
parent
79941b52
No related branches found
No related tags found
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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/image/image.module
+2
-1
2 additions, 1 deletion
core/modules/image/image.module
core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php
+6
-0
6 additions, 0 deletions
...mage/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php
with
8 additions
and
1 deletion
core/modules/image/image.module
+
2
−
1
View file @
afeed9ed
...
@@ -301,7 +301,8 @@ function image_file_download($uri) {
...
@@ -301,7 +301,8 @@ function image_file_download($uri) {
if
(
$info
=
image_get_info
(
$uri
))
{
if
(
$info
=
image_get_info
(
$uri
))
{
// Check the permissions of the original to grant access to this image.
// Check the permissions of the original to grant access to this image.
$headers
=
module_invoke_all
(
'file_download'
,
$original_uri
);
$headers
=
module_invoke_all
(
'file_download'
,
$original_uri
);
if
(
!
in_array
(
-
1
,
$headers
))
{
// Confirm there's at least one module granting access and none denying access.
if
(
!
empty
(
$headers
)
&&
!
in_array
(
-
1
,
$headers
))
{
return
array
(
return
array
(
// Send headers describing the image's size, and MIME-type...
// Send headers describing the image's size, and MIME-type...
'Content-Type'
=>
$info
[
'mime_type'
],
'Content-Type'
=>
$info
[
'mime_type'
],
...
...
This diff is collapsed.
Click to expand it.
core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php
+
6
−
0
View file @
afeed9ed
...
@@ -136,6 +136,12 @@ function _testImageStyleUrlAndPath($scheme, $clean_url = TRUE) {
...
@@ -136,6 +136,12 @@ function _testImageStyleUrlAndPath($scheme, $clean_url = TRUE) {
$this
->
drupalGet
(
$generate_url
);
$this
->
drupalGet
(
$generate_url
);
$this
->
assertResponse
(
200
,
'Image was generated at the URL.'
);
$this
->
assertResponse
(
200
,
'Image was generated at the URL.'
);
// Make sure that access is denied for existing style files if we do not
// have access.
state
()
->
delete
(
'image.test_file_download'
);
$this
->
drupalGet
(
$generate_url
);
$this
->
assertResponse
(
403
,
'Confirmed that access is denied for the private image style.'
);
// Repeat this with a different file that we do not have access to and
// Repeat this with a different file that we do not have access to and
// make sure that access is denied.
// make sure that access is denied.
$file_noaccess
=
array_shift
(
$files
);
$file_noaccess
=
array_shift
(
$files
);
...
...
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