Not working for js and other fixes

Created on 23 August 2022, over 2 years ago
Updated 18 April 2023, almost 2 years ago

Problem/Motivation

1. The asset_type in MissingAsset.php is only working for css.
2. Warning: Undefined variable $result in optimized_assets_proxy_restore_file() (line 48 of /modules/contrib/optimized_assets_proxy/optimized_assets_proxy.module)
3. Only .gz files are generated, styles remain broken.

Steps to reproduce

Install on Drupal site, manually delete an aggregated js file, and try to reload a page that uses it. Js is not regenerated.

Proposed resolution

1. The asset_type in MissingAsset.php is set to $matches[1] from the regex, but that will always return the first capture group, which is css. Js asset types need to use $matches[2].
2. Defined $result
3. This one I'm not entirely sure about, but the module didn't work without this change. Updated optimized_assets_proxy_restore_file to only create a .css.gz or .js.gz file if that is the extension of the missing file, otherwise create a .css or .js file.

Patch attached with all of the noted changes.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cecrs

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024