After doing some testing with how Glitch’s assets work, I was able to create an asset that will completely crash your Glitch editor when you open the Assets tab.
(The way I discovered this was not intentional, I was just testing some code in the console using the application
object)
First, create a new project and run this code in the console:
application.newAsset({
name: "chrome.png",
url: "https://cdn.glitch.global/034c54c9-da3c-4cd1-876f-1564a4effdfc/chrome.png",
});
application.renameAsset({
url: "https://cdn.glitch.global/034c54c9-da3c-4cd1-876f-1564a4effdfc/chrome.png"}, {
url: "https://cdn.glitch.global/034c54c9-da3c-4cd1-876f-1564a4effdfc/example.png"
}) // this is just an example, I don't think this format is specifically needed to cause the crash
This adds the following lines to your .glitch-assets
:
{"name":"chrome.png","url":"https://cdn.glitch.global/034c54c9-da3c-4cd1-876f-1564a4effdfc/chrome.png"}
{"deleted":true}
{"url":"https://cdn.glitch.global/a749211c-fb5c-4403-a856-e741eeaf9946/[object Object]","name":{"url":"https://cdn.glitch.global/034c54c9-da3c-4cd1-876f-1564a4effdfc/example.png"}}
Now, if you ever open the Assets tab again, it will crash your editor with this message in the console:
TypeError: l.match is not a function
I was able to get around this by resetting the .glitch-assets file myself, but it’s pretty cool and I wanted to report it. It has a ton of troll potential tho.
Solution: Add try ... catch ...
to the assets rendering code that if an error is thrown will instead of crashing the whole editor just show a message in the assets page saying something like “Unable to render assets: Invalid or corrupted .glitch-assets file” instead of crashing the whole editor.
POC: ~assets-crasher > open assets tab
Note: I think this works with any invalid .glitch-assets
file (you don’t need to use the code above with the console), but I’m not sure