J4 Issue ?
avatar PhilETaylor
PhilETaylor
7 Oct 2020

Steps to reproduce the issue

In Joomla 4 you have the ability to delete files in the Template Manager

If you attempt to delete your frontend templates index.php file you are prevented from doing so

If you attempt to delete your frontend templates joomla.asset.json file you are NOT prevented from doing so

If you delete joomla.asset.json then you whole site will crash.

Expected result

joomla.asset.json to be a protected file like index.php is and cannot be deleted using the web interface template manager.

Actual result

delete joomla.asset.json and your site is now crashed with a generic 500 error message

same happens if you make a typo in this file.

avatar PhilETaylor PhilETaylor - open - 7 Oct 2020
avatar joomla-cms-bot joomla-cms-bot - change - 7 Oct 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 7 Oct 2020
avatar Fedik
Fedik - comment - 7 Oct 2020

If you delete joomla.asset.json then you whole site will crash.

It not the file is required, but the content in it.
Empty file or removed an asset definition in the file may lead to crash as well

avatar PhilETaylor
PhilETaylor - comment - 7 Oct 2020

Yes, like I said: :-)

same happens if you make a typo in this file.

avatar Fedik
Fedik - comment - 7 Oct 2020

this is third reason ;)

  • file removed
  • typo in file (invalid json)
  • file does not have all assets that used by template

In general the file:

  • must be valid json
  • should contain valid markup schema: https://developer.joomla.org/schemas/json-schema/web_assets.json
  • should contain all assets definitions that used by template

But note: If the template defines all assets in its index.php (component.php etc) then file can be removed.

avatar wilsonge
wilsonge - comment - 17 Oct 2020

We could/should probably at least validate the JSON in the file

avatar joomla-cms-bot joomla-cms-bot - edited - 2 Nov 2020
avatar jwaisner jwaisner - change - 2 Nov 2020
Labels Added: J4 Issue
avatar jwaisner jwaisner - labeled - 2 Nov 2020
avatar wilsonge
wilsonge - comment - 18 Dec 2020

joomla.asset.json to be a protected file like index.php is and cannot be deleted using the web interface template manager.

So this one (I've just tested) is a bit more tricky. It fails because none of the assets cassiopeia uses in joomla.asset.json are being found (for obvious reasons).

However in a 3rd party template obviously this doesn't have to be the case. We even have the assetExists method which we use in some of our components for this.

I guess the reality though is probably if a component ships this file then it shouldn't be deleted however... We just need to be careful to ensure that we don't require templates to ship with one.

avatar Fedik
Fedik - comment - 18 Dec 2020

I guess the reality though is probably if a component ships this file then it shouldn't be deleted however

I agree, same for template, if template ships this file then it shouldn't be deleted.

We just need to be careful to ensure that we don't require templates to ship with one.

In documentation we already have a note:

Note: Having joomla.asset.json for your extension or template are recommend but not required to WebAssset to work (see next section).

Maybe can elaborate that note, somehow.

avatar wilsonge
wilsonge - comment - 18 Dec 2020

PR #31710

avatar wilsonge wilsonge - change - 18 Dec 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-12-18 16:32:07
Closed_By wilsonge
avatar wilsonge wilsonge - close - 18 Dec 2020

Add a Comment

Login with GitHub to post a comment