Fix Ajax.ajax_url_to_controller_action to handle function/object references
Fix VS Code extension installation on UNC paths 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -419,11 +419,23 @@ class Ajax {
|
|||||||
/**
|
/**
|
||||||
* Parses an AJAX URL into controller and action
|
* Parses an AJAX URL into controller and action
|
||||||
* Supports both /_ajax/ and /_/ URL prefixes
|
* 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}
|
* @returns {Object} Object with {controller: string, action: string}
|
||||||
* @throws {Error} If URL doesn't start with /_ajax or /_ or has invalid structure
|
* @throws {Error} If URL doesn't start with /_ajax or /_ or has invalid structure
|
||||||
*/
|
*/
|
||||||
static ajax_url_to_controller_action(url) {
|
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('/_/')) {
|
if (!url.startsWith('/_ajax') && !url.startsWith('/_/')) {
|
||||||
throw new Error(`URL must start with /_ajax or /_, got: ${url}`);
|
throw new Error(`URL must start with /_ajax or /_, got: ${url}`);
|
||||||
}
|
}
|
||||||
|
|||||||
0
app/RSpade/resource/vscode_extension/rspade-framework.vsix
Normal file → Executable file
0
app/RSpade/resource/vscode_extension/rspade-framework.vsix
Normal file → Executable file
Reference in New Issue
Block a user