bug #31893 [HttpKernel] fix link to source generation (nicolas-grekas)
This PR was merged into the 4.3 branch.
Discussion
----------
[HttpKernel] fix link to source generation
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #31833
| License | MIT
| Doc PR | -
Introduced in #30301
Commits
-------
4a4b62bf4d
[HttpKernel] fix link to source generation
This commit is contained in:
commit
fc2a86fc3f
@ -68,7 +68,7 @@ class FileLinkFormatter
|
|||||||
*/
|
*/
|
||||||
public function __sleep(): array
|
public function __sleep(): array
|
||||||
{
|
{
|
||||||
$this->getFileLinkFormat();
|
$this->fileLinkFormat = $this->getFileLinkFormat();
|
||||||
|
|
||||||
return ['fileLinkFormat'];
|
return ['fileLinkFormat'];
|
||||||
}
|
}
|
||||||
@ -87,17 +87,19 @@ class FileLinkFormatter
|
|||||||
|
|
||||||
private function getFileLinkFormat()
|
private function getFileLinkFormat()
|
||||||
{
|
{
|
||||||
|
if ($this->fileLinkFormat) {
|
||||||
|
return $this->fileLinkFormat;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->requestStack && $this->baseDir && $this->urlFormat) {
|
if ($this->requestStack && $this->baseDir && $this->urlFormat) {
|
||||||
$request = $this->requestStack->getMasterRequest();
|
$request = $this->requestStack->getMasterRequest();
|
||||||
|
|
||||||
if ($request instanceof Request && (!$this->urlFormat instanceof \Closure || $this->urlFormat = ($this->urlFormat)())) {
|
if ($request instanceof Request && (!$this->urlFormat instanceof \Closure || $this->urlFormat = ($this->urlFormat)())) {
|
||||||
$this->fileLinkFormat = [
|
return [
|
||||||
$request->getSchemeAndHttpHost().$request->getBasePath().$this->urlFormat,
|
$request->getSchemeAndHttpHost().$request->getBasePath().$this->urlFormat,
|
||||||
$this->baseDir.\DIRECTORY_SEPARATOR, '',
|
$this->baseDir.\DIRECTORY_SEPARATOR, '',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->fileLinkFormat;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user