Forum
Assets App.
In the latest update to Perch: 2.5.4, it seems the Add Asset button doesn't appear when an editor tries to upload an image through a template. It does appear when accessing it through the Asset App.
Is that a role issue, or something else?
In the update notes I saw this "Fixes timing issue with JavaScript loading causing ‘add asset’ button not to appear"
This is the view in the Asset Manager when accessed through a template image upload.
This is the view in the Asset Manager when accessed through the Asset App
I've isolated this issue to Chrome Version 36.0.1985.125.
The button does appear as expected in Safari version 7.0.5 and Firefox 30.
Could it be caching?
I tried to clear cache on Chrome to no effect. I then completely cleared all files, closed Chrome and opened the browser again. Unfortunately still no effect.
I looked in Chrome console and saw these two error messages
Refused to execute script from 'https://www.environment.ucla.edu/perch/core/inc/js_lang.php' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.
Refused to execute script from 'https://www.environment.ucla.edu/perch/core/inc/js_privs.php' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.
Addendum
I funneled both through Assets and through upload image on a page template and the script error showed up in both places.
I think I found the cause of the problem.
In my .htaccess file I had this bit of code
When I removed it, the problem was fixed. And the two error Console errors also aren't showing up.
Here was the info in my .htaccess file.
Ok, that's really weird. I don't see why there would be an issue - it's a JSON file served with a JSON mime type. I'll take a look into it.
Maybe a conflict with something else in .htaccess?
Or (doubtful)
Or gzip (doubtful)
Is this all from HTML5 Boilerplate?
No on gzip. Yes, on XSS, yes on nosniff,
Plenty of HTML 5 boilerplate is not used.
Back to sleep for me in LA, and I need to run some more tests during day.
Plus side — commenting out nosniff worked.
Ok, I've changed the mime type to
application/javascript
and that appears to stop its whinging.Thanks Drew.
Whinging is a new word in my vocabulary.
Quick dummy check. Will your change will be rolled into the next update?
Yes, it'll be in 2.5.5.