ErikE
Forum Replies Created
-
Forum: Plugins
In reply to: [File Manager] Folders not openingIn my case, environment:
WP File Manager Version 8.0.4
Elementor Version 4.1.1
WordPress 6.9.4
PHP 8.4There appears to be a conflict between WP File Manager and recent versions of Elementor.
Recent Elementor releases include a new AI Feature “Angie”, which sends a postMessage() event with a message type of sdk-angie-ready-ping. The message payload is sent as a JavaScript object rather than a JSON string.
WP File Manager’s elFinder.js registers a message event listener:
jQuery(window).on('message.' + namespace, function(e) {
var res = e.originalEvent || null,
obj, data;
...
});The handler then attempts to parse all message payloads as JSON:
obj = JSON.parse(res.data);When Elementor’s sdk-angie-ready-ping message is received, res.data is already an object.
As a result, elFinder.js JSON.parse() throws an exception:
SyntaxError: “[object Object]” is not valid JSON at JSON.parse
because JSON.parse() expects a JSON string, not a JavaScript object.After this exception occurs, the WP File Manager UI fails to function correctly as described in this post.
No related errors are logged to:
Browser console
WordPress debug log
PHP error logThe only visible indication is the JavaScript exception, which I identified by stepping through the code with the browser debugger and observing the try/catch block in the elFinder.js listener failing.
I have patched this code locally to handle both JSON strings and object payloads before calling JSON.parse(), and after doing so the issue no longer occurs in my environment.
For example:// Handle both JSON strings and objects
if (typeof res.data === 'string') {
obj = JSON.parse(res.data);
} else if (res.data && typeof res.data === 'object') {
obj = res.data;
} else {
return; // Ignore unsupported message types?
}
//obj = JSON.parse(res.data); // Incorrectly assumes string but could be object, number, array, etc.Disclaimer: This is not claimed to be any type fix or proper handling, only what I have observed in testing. Any proper fix should be made officially and in the plugin.
I appreciate that this may not be the only cause of the reported issue, but it appears to be a reproducible compatibility problem in my environment.
Could the plugin developers please review this and confirm whether elFinder.js should support non-string postMessage() payloads?
Thank you, Erik
- This reply was modified 4 days, 15 hours ago by ErikE.
Forum: Plugins
In reply to: [File Manager] Folders not openingSimilar issue here.
@smarti9 @alain-lankers
Are either of you using Elementor as well?I have found the issue only occurs for me after updating from Elementor Version 4.0.7 to 4.1.1, where Folders become unresponsive. I can right click a folder and select Open in new Window to see the folder, but folders are otherwise inaccessable.
Rolling back the Elementor plugin reverts the issue for me.
Still on WordPress 6.9.4.