Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit 078d000

Browse files
authored
Do not minify if the body is json
1 parent bed056e commit 078d000

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

code/SS_RelativeAssetsResponse.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ public function setBody($body)
2525

2626
$body = str_replace('"/assets/', '"assets/', $body);
2727
$body = str_replace('"assets/', '"/assets/', $body);
28+
29+
json_decode($body);
30+
$bodyIsJson = json_last_error() === JSON_ERROR_NONE;
2831

2932

30-
if (class_exists('zz\Html\HTMLMinify')) {
33+
if (!$bodyIsJson && class_exists('zz\Html\HTMLMinify')) {
3134
$this->body = zz\Html\HTMLMinify::minify($body, [
3235
'doctype' => zz\Html\HTMLMinify::DOCTYPE_HTML5,
3336
'optimizationLevel' => zz\Html\HTMLMinify::OPTIMIZATION_ADVANCED

0 commit comments

Comments
 (0)