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
ec5b4345
Commit
ec5b4345
authored
May 1, 2014
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2198325
by fietserwin: GetPathToken not in ImageStyleInterface (+2 other minor cleanups).
parent
6a0257c2
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/lib/Drupal/image/Entity/ImageStyle.php
+3
-13
3 additions, 13 deletions
core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
core/modules/image/lib/Drupal/image/ImageStyleInterface.php
+16
-2
16 additions, 2 deletions
core/modules/image/lib/Drupal/image/ImageStyleInterface.php
with
19 additions
and
15 deletions
core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
+
3
−
13
View file @
ec5b4345
...
@@ -310,21 +310,11 @@ public function transformDimensions(array &$dimensions) {
...
@@ -310,21 +310,11 @@ public function transformDimensions(array &$dimensions) {
}
}
/**
/**
* Generates a token to protect an image style derivative.
* {@inheritdoc}
*
* This prevents unauthorized generation of an image style derivative,
* which can be costly both in CPU time and disk space.
*
* @param string $uri
* The URI of the original image of this style.
*
* @return string
* An eight-character token which can be used to protect image style
* derivatives against denial-of-service attacks.
*/
*/
public
function
getPathToken
(
$uri
)
{
public
function
getPathToken
(
$uri
)
{
// Return the first
eight
characters.
// Return the first
8
characters.
return
substr
(
Crypt
::
hmacBase64
(
$this
->
id
()
.
':'
.
$uri
,
d
rupal
_get_
private_key
()
.
drupal_get_hash_salt
()),
0
,
8
);
return
substr
(
Crypt
::
hmacBase64
(
$this
->
id
()
.
':'
.
$uri
,
\D
rupal
::
service
(
'
private_key
'
)
->
get
()
.
drupal_get_hash_salt
()),
0
,
8
);
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
core/modules/image/lib/Drupal/image/ImageStyleInterface.php
+
16
−
2
View file @
ec5b4345
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
namespace
Drupal\image
;
namespace
Drupal\image
;
use
Drupal\Core\Config\Entity\ConfigEntityInterface
;
use
Drupal\Core\Config\Entity\ConfigEntityInterface
;
use
Drupal\image\ImageEffectInterface
;
/**
/**
* Provides an interface defining an image style entity.
* Provides an interface defining an image style entity.
...
@@ -70,10 +69,25 @@ public function buildUri($uri);
...
@@ -70,10 +69,25 @@ public function buildUri($uri);
* The absolute URL where a style image can be downloaded, suitable for use
* The absolute URL where a style image can be downloaded, suitable for use
* in an <img> tag. Requesting the URL will cause the image to be created.
* in an <img> tag. Requesting the URL will cause the image to be created.
*
*
* @see \Drupal\image\
ImageStyleInterface
::deliver()
* @see \Drupal\image\
Controller\ImageStyleDownloadController
::deliver()
*/
*/
public
function
buildUrl
(
$path
,
$clean_urls
=
NULL
);
public
function
buildUrl
(
$path
,
$clean_urls
=
NULL
);
/**
* Generates a token to protect an image style derivative.
*
* This prevents unauthorized generation of an image style derivative,
* which can be costly both in CPU time and disk space.
*
* @param string $uri
* The URI of the original image of this style.
*
* @return string
* An eight-character token which can be used to protect image style
* derivatives against denial-of-service attacks.
*/
public
function
getPathToken
(
$uri
);
/**
/**
* Flushes cached media for this style.
* Flushes cached media for this style.
*
*
...
...
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