Skip to content

Commit

Permalink
Merge 1b29146 into 3c4940a
Browse files Browse the repository at this point in the history
  • Loading branch information
swordfox committed Sep 25, 2023
2 parents 3c4940a + 1b29146 commit 1f85e70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 0 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
"email": "tim@dorset-digital.net"
}
],
"require": {
"silverstripe/vendor-plugin": "^1.0",
"silverstripe/cms": "^4.0"
},
"license": "BSD-3-Clause",
"autoload": {
"psr-4": {
Expand Down
4 changes: 4 additions & 0 deletions src/CDNMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ private function canRun()
*/
private function rewriteTags(&$body, &$response)
{
$body = ($body ?: '');

$cdn = $this->config()->get('cdn_domain');
$subDir = $this->getSubdirectory();
$prefixes = $this->config()->get('rewrites');
Expand All @@ -136,6 +138,7 @@ private function rewriteTags(&$body, &$response)
'src="/' . $subDir . $cleanPrefix . '/',
'src=\"/' . $subDir . $cleanPrefix . '/',
'href="/' . $subDir . $cleanPrefix . '/',
'background-image: url(/' . $subDir . $cleanPrefix . '/',
Director::absoluteBaseURL() . $cleanPrefix . '/'
];

Expand All @@ -144,6 +147,7 @@ private function rewriteTags(&$body, &$response)
'src="' . $cdn . '/' . $subDir . $cleanPrefix . '/',
'src=\"' . $cdn . '/' . $subDir . $cleanPrefix . '/',
'href="' . $cdn . '/' . $subDir . $cleanPrefix . '/',
'background-image: url(' . $cdn . '/' . $subDir . $cleanPrefix . '/',
$cdn . '/' . $subDir . $cleanPrefix . '/'
];

Expand Down

0 comments on commit 1f85e70

Please sign in to comment.