Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flysystem
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
flysystem
Merge requests
!86
Support overriding assets:// in core
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Support overriding assets:// in core
issue/flysystem-3499242:3499242-support-replacing-drupal
into
2.3.x
Overview
0
Commits
1
Pipelines
1
Changes
2
Open
Brad Jones
requested to merge
issue/flysystem-3499242:3499242-support-replacing-drupal
into
2.3.x
2 months ago
Overview
0
Commits
1
Pipelines
1
Changes
2
Expand
Closes
#3499242
0
0
Merge request reports
Compare
2.3.x
2.3.x (HEAD)
and
latest version
latest version
111c9379
1 commit,
2 months ago
2 files
+
20
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
src/FlysystemBridge.php
+
19
−
0
Options
@@ -3,7 +3,9 @@
namespace
Drupal\flysystem
;
use
Drupal\Core\StreamWrapper\StreamWrapperInterface
;
use
Drupal\Core\StreamWrapper\StreamWrapperManager
;
use
Drupal\Core\StringTranslation\StringTranslationTrait
;
use
Drupal\Core\Url
;
use
League\Flysystem\FilesystemInterface
;
use
League\Flysystem\Util
;
use
Codementality\FlysystemStreamWrapper\FlysystemStreamWrapper
;
@@ -69,6 +71,23 @@ class FlysystemBridge extends FlysystemStreamWrapper implements StreamWrapperInt
* {@inheritdoc}
*/
public
function
getExternalUrl
()
{
// Assets is a special case as Drupal generates these on the fly, similar
// to how image styles have historically operated. This requires Drupal to
// always be inline of this request. On repeat visits, the asset will be
// piped through to the client, but this is not as fast as serving directly
// from disk or worse, from object storage over the network. Sites wishing
// to offload serving the generated assets should consider pairing Flysystem
// with CDN module and treating these assets as "far-future" URLs.
if
(
StreamWrapperManager
::
getScheme
(
$this
->
uri
)
===
'assets'
)
{
$target
=
$this
->
getTarget
(
$this
->
uri
);
return
Url
::
fromRoute
(
sprintf
(
'system.%s_asset'
,
current
(
explode
(
DIRECTORY_SEPARATOR
,
$target
,
2
))),
// @todo Use Drupal's FileSystem::basename() if we can make it static.
[
'file_name'
=>
basename
(
$target
)],
)
->
toString
(
TRUE
)
->
getGeneratedUrl
();
}
return
$this
->
getFactory
()
->
getPlugin
(
$this
->
getProtocol
())
Loading