You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix VS Code extension commands failing with undefined fsPath in virtual file systems (#6601)
* Initial plan
* Add defensive checks for undefined fsPath in VS Code extension commands
This fixes the issue where provision and other commands would fail with
"The 'path' argument must be of type string. Received undefined" when
used with virtual file systems or certain VS Code contexts.
Changes:
- Added validation for selectedFile.fsPath before calling getWorkingFolder
- Provides clear error messages that include URI scheme and selectedItem type
- Suppresses automatic issue reporting since this is a user error
- Applied fix to all affected commands: provision, deploy, up, down, restore, monitor, packageCli, and pipelineConfig
- Added unit tests for the new validation logic
Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
* Simplify provision.test.ts based on code review feedback
Removed unused stub functions that weren't actually being used.
Simplified tests to focus on the core validation logic.
Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
* Refactor validation logic into shared utility function
Based on code review feedback:
- Extracted duplicated validation logic to validateFileSystemUri() in cmdUtil.ts
- Updated all 8 command files to use the shared function
- Simplified test assertions
- Improved code maintainability by reducing duplication
Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
* Fix validation to use strict equality check for undefined
Changed condition from `!selectedFile.fsPath` to `selectedFile.fsPath === undefined`
to avoid incorrectly rejecting empty string paths which are valid for root directories.
Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
* Fix l10n.t() to use single string literal instead of concatenation
The first argument to vscode.l10n.t() should be a single string literal
for proper localization tooling compatibility. Removed string concatenation
and used a single multi-line string literal instead.
Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
"Unable to determine working folder for {0} command. The selected file has an unsupported URI scheme '{1}' (selectedItem type: {2}). Azure Developer CLI commands are not supported in virtual file systems. Please open a local folder or clone the repository locally.",
38
+
commandName,
39
+
selectedFile.scheme,
40
+
itemType
41
+
));
42
+
}
43
+
}
44
+
15
45
// If the command was invoked with a specific file context, use the file context as the working directory for running Azure developer CLI commands.
16
46
// Otherwise search the workspace for "azure.yaml" or "azure.yml" files. If only one is found, use it (i.e. its folder). If more than one is found, ask the user which one to use.
17
47
// If at this point we still do not have a working directory, prompt the user to select one.
constconfirmPrompt=vscode.l10n.t("Are you sure you want to delete all this application's Azure resources? You can soft-delete certain resources like Azure KeyVaults to preserve their data, or permanently delete and purge them.");
0 commit comments