Add explicit arg for enclosing resource path in quotes#1534
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an includeQuotes option for resource path arguments so adapter-invoked resources can preserve path quoting when routed through PowerShell command parsing.
Changes:
- Extends manifest argument models with
includeQuotes. - Applies quote-wrapping when processing resource path args.
- Enables the option for the PowerShell adapter and adds a dsctest coverage scenario.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
lib/dsc-lib/src/dscresources/resource_manifest.rs |
Adds includeQuotes to resource path argument definitions. |
lib/dsc-lib/src/dscresources/command_resource.rs |
Wraps resource paths in quotes when requested. |
adapters/powershell/PowerShell_adapter.dsc.resource.json |
Enables quoted resource paths for PowerShell adapter operations. |
tools/dsctest/dsctest.dsc.manifests.json |
Adds test manifest usage of includeQuotes. |
dsc/tests/dsc_adapter.tests.ps1 |
Adds a Pester assertion for quoted resource path arguments. |
tgauth
reviewed
May 14, 2026
tgauth
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
If a PowerShell resource is in a folder that has spaces (like
OneDrive), then the code flow:sequenceDiagram dsc->>pwsh: pwsh -c powershell.resource.ps1 --resourcePath "c:\users\test\OneDrive - Test\resource.psm1" pwsh->>script: powershell.resource.ps1 --resourcePath c:\users\tests\OneDrive - Test\resource.psm1dscsends the path with quotes topwsh, but whenpwshreceives it, the correct value is sent, but the quotes have been stripped. So whenpwshsends the path topowershell.resource.ps1the lack of quotes means it thinks they are positional parameters and fails.The fix is to introduce a new optional property for:
{ "resourcePathArg": "--foo", "includeQuotes": true }This will add additional quotes:
sequenceDiagram dsc->>pwsh: pwsh -c powershell.resource.ps1 --resourcePath "\"c:\users\test\OneDrive - Test\resource.psm1\"" pwsh->>script: powershell.resource.ps1 --resourcePath "c:\users\tests\OneDrive - Test\resource.psm1"So when the outer quotes are stripped, the inner quotes remain and get passed correctly to
powershell.resource.ps1.The test verifies that the correct escaped inner quotes are sent to the resource process.