Problem/Motivation

There seems to be a small logic error in this class, the $optimize_js variable can become TRUE only when the site is in maintenance mode

    // Aggregate CSS/JS if necessary, but only during normal site operation.
    $optimize_css = !$maintenance_mode && $this->config->get('css.preprocess');
    $optimize_js = $maintenance_mode && $this->config->get('js.preprocess');

Steps to reproduce

Proposed resolution

* Fix the variable assignment to include the missing exclamation mark.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3439946

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nevahen created an issue. See original summary.

nevahen’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs steps to reproduce

Thank you for reporting but can you provide steps to reproduce?

This may also require test to show the problem.

nevahen’s picture

This is something I noticed while I was debugging something else.

A small piece of the diff From this issue https://www.drupal.org/project/drupal/issues/3373328 shows possible typo / missing ! on the $optimize_js part

-    $optimize_css = !defined('MAINTENANCE_MODE') && $this->config->get('css.preprocess');
-    $optimize_js = !defined('MAINTENANCE_MODE') && $this->config->get('js.preprocess');
+    $optimize_css = !$maintenance_mode && $this->config->get('css.preprocess');
+    $optimize_js = $maintenance_mode && $this->config->get('js.preprocess');

I guess one could check cache keys during ajax request, as the AssetResolver won't generate "1" as last character due the current implementation - I'll check later if I can do some simple steps if they are needed.