From dbc5e6de1cf2055b8b121b70d1ceb5403257c85f Mon Sep 17 00:00:00 2001 From: root Date: Thu, 30 Oct 2025 22:43:11 +0000 Subject: [PATCH] Fix Ajax.ajax_url_to_controller_action to handle function/object references Fix VS Code extension installation on UNC paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/RSpade/Core/Js/Ajax.js | 14 +++++++++++++- .../vscode_extension/rspade-framework.vsix | Bin 2 files changed, 13 insertions(+), 1 deletion(-) mode change 100644 => 100755 app/RSpade/resource/vscode_extension/rspade-framework.vsix 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