diff --git a/app/RSpade/Core/Js/Ajax.js b/app/RSpade/Core/Js/Ajax.js index 2bcd1b41b..7745041f2 100755 --- a/app/RSpade/Core/Js/Ajax.js +++ b/app/RSpade/Core/Js/Ajax.js @@ -419,11 +419,23 @@ class Ajax { /** * Parses an AJAX URL into controller and action * Supports both /_ajax/ and /_/ URL prefixes - * @param {string} url - URL in format '/_ajax/Controller_Name/action_name' or '/_/Controller_Name/action_name' + * @param {string|object|function} url - URL in format '/_ajax/Controller_Name/action_name' or '/_/Controller_Name/action_name', or an object/function with a .path property * @returns {Object} Object with {controller: string, action: string} * @throws {Error} If URL doesn't start with /_ajax or /_ or has invalid structure */ static ajax_url_to_controller_action(url) { + // If url is an object or function with a .path property, use that as the URL + if (url && typeof url === 'object' && url.path) { + url = url.path; + } else if (url && typeof url === 'function' && url.path) { + url = url.path; + } + + // Validate url is a string + if (typeof url !== 'string') { + throw new Error(`URL must be a string or have a .path property, got: ${typeof url}`); + } + if (!url.startsWith('/_ajax') && !url.startsWith('/_/')) { throw new Error(`URL must start with /_ajax or /_, got: ${url}`); } diff --git a/app/RSpade/resource/vscode_extension/rspade-framework.vsix b/app/RSpade/resource/vscode_extension/rspade-framework.vsix old mode 100644 new mode 100755