Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with decompiled assets in 1.2 #562

Closed
Tracked by #148
xitara opened this issue May 20, 2022 · 7 comments
Closed
Tracked by #148

Error with decompiled assets in 1.2 #562

xitara opened this issue May 20, 2022 · 7 comments
Assignees

Comments

@xitara
Copy link
Contributor

xitara commented May 20, 2022

I installed a fresh wintercms 1.1.8 and upgraded to 1.2
if I set 'decompileBackendAssets' => true, I get the following error:

File https://tb.tbtest.andoria/modules/backend/widgets/mediamanager/assets/js/mediamanager-browser.js does not exist to be decompiled.

.../modules/backend/helpers/Backend.php line 229

I think, the problem is, there is an URL and not a file-path given in $file. In another 1.1.8 install it works fine.

Tell me, if you need infos about my setup

@xitara xitara changed the title Error with decompiled assets Error with decompiled assets in 1.2 May 20, 2022
@LukeTowers LukeTowers transferred this issue from wintercms/meta May 21, 2022
@LukeTowers LukeTowers added Type: Unconfirmed Bug needs review Issues/PRs that require a review from a maintainer labels May 21, 2022
@bennothommo
Copy link
Member

@LukeTowers yeah I have the same issue occurring. It's due to the Asset Maker PR that was merged recently, and the fact that now all assets are using a URL. I was meaning to ask Jack or yourself what the change was for.

@LukeTowers
Copy link
Member

@bennothommo it's to support having your assets published on a CDN, specifically on Laravel Vapor it was an issue where any assets added via the AssetMaker trait weren't respecting the asset_url config value and thus weren't loading. We should just be able to add support for the app.asset_url config value to the asset decompiler and it should just work.

@bennothommo
Copy link
Member

@LukeTowers ok, gotcha, however, is that needed for assets that are included in the core? I can see the case for plugins, where they may be externally stored, but the ones in core that actually are candidates for decompilation should still be loaded locally? Unless you are moving those externally as well?

@LukeTowers
Copy link
Member

LukeTowers commented May 22, 2022

When using a CDN as a part of your deployed Winter instance the idea is for all assets to be served through it, so loading any assets "locally" would be a bit pointless.

I imagine that the decompiler should be able to just strip off the asset URL before attempting to decompile an asset, no?

@bennothommo
Copy link
Member

Sure, we can do that. If the assets are not available locally though, it will fail.

@LukeTowers
Copy link
Member

That should be fine, the asset URL helper should only be adding to assets that are available locally anyways, and you certainly wouldn't actually be using the asset decompiler in an environment like Vapor where the assets might not even be present on the server at all.

bennothommo added a commit that referenced this issue May 25, 2022
#552 introduced a change where all backend assets are converted to URLs to provide support for the `app.asset_url` configuration variable. This change allows asset decompilation to still work by converting a (local) URL back to a relative path. If a URL doesn't match the root URL, then it is passed through as is with no decompilation taking place.

Fixes #562.
@bennothommo bennothommo added Status: Completed and removed needs review Issues/PRs that require a review from a maintainer labels May 25, 2022
@bennothommo
Copy link
Member

Fixed by 805b95b.

bennothommo added a commit to wintercms/wn-backend-module that referenced this issue May 26, 2022
wintercms/winter#552 introduced a change where all backend assets are converted to URLs to provide support for the `app.asset_url` configuration variable. This change allows asset decompilation to still work by converting a (local) URL back to a relative path. If a URL doesn't match the root URL, then it is passed through as is with no decompilation taking place.

Fixes wintercms/winter#562.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants