Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
stage_file_proxy
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
stage_file_proxy
Commits
06706daa
Commit
06706daa
authored
Jan 23, 2024
by
Stephen Mustgrave
Browse files
Options
Downloads
Patches
Plain Diff
Revert
#3402972
parent
e0f38fc0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#81435
failed
Jan 23, 2024
Stage: build
Stage: validate
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/EventSubscriber/StageFileProxySubscriber.php
+8
-14
8 additions, 14 deletions
src/EventSubscriber/StageFileProxySubscriber.php
with
8 additions
and
14 deletions
src/EventSubscriber/StageFileProxySubscriber.php
+
8
−
14
View file @
06706daa
...
...
@@ -155,18 +155,11 @@ class StageFileProxySubscriber implements EventSubscriberInterface {
// If file is fetched and use_imagecache_root is set, original is used.
$paths
=
[
$relative_path
];
// Image style file conversion support.
$unconverted_path
=
static
::
getFilePathWithoutConvertedExtension
(
$relative_path
);
if
(
$unconverted_path
!==
$relative_path
)
{
if
(
$config
->
get
(
'use_imagecache_root'
))
{
// Check the unconverted file path first in order to use the local
// original image.
array_unshift
(
$paths
,
$unconverted_path
);
}
else
{
// Check the unconverted path after the image derivative.
$paths
[]
=
$unconverted_path
;
}
// Webp support.
$is_webp
=
FALSE
;
if
(
strpos
(
$relative_path
,
'.webp'
))
{
$paths
[]
=
str_replace
(
'.webp'
,
''
,
$relative_path
);
$is_webp
=
TRUE
;
}
foreach
(
$paths
as
$relative_path
)
{
...
...
@@ -182,12 +175,12 @@ class StageFileProxySubscriber implements EventSubscriberInterface {
// Is this imagecache? Request the root file and let imagecache resize.
// We check this first so locally added files have precedence.
$original_path
=
$this
->
manager
->
styleOriginalPath
(
$relative_path
,
TRUE
);
if
(
$original_path
)
{
if
(
$original_path
&&
!
$is_webp
)
{
if
(
file_exists
(
$original_path
))
{
// Imagecache can generate it without our help.
return
;
}
if
(
$config
->
get
(
'use_imagecache_root'
)
&&
$unconverted_path
===
$relative_path
)
{
if
(
$config
->
get
(
'use_imagecache_root'
))
{
// Config says: Fetch the original.
$fetch_path
=
StreamWrapperManager
::
getTarget
(
$original_path
);
}
...
...
@@ -235,6 +228,7 @@ class StageFileProxySubscriber implements EventSubscriberInterface {
* Defaults to the $path when the $path does not have a double extension.
*
* @todo Use ImageStyleDownloadController method for a URI once https://www.drupal.org/project/drupal/issues/2786735 has been committed.
* @todo this is used by #3402972 but caused regressions.
*/
public
static
function
getFilePathWithoutConvertedExtension
(
string
$path
):
string
{
$original_path
=
$path
;
...
...
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