Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command arguments containing spaces treated differently to ones without #129

Open
Adam-Langley opened this issue Nov 20, 2024 · 0 comments

Comments

@Adam-Langley
Copy link
Contributor

Adam-Langley commented Nov 20, 2024

I am using the "FlutterCommand" task to create an MSIX file for deployment on Microsoft Windows.
Because I will be producing two different MSIX outputs, one for Microsoft Store distribution, and one for "side loading" (direct file installation on Windows) - I will be using two different "publisher" argument values.
One of them is a publisher matching my own digital certification, and it contains spaces. The other one is assigned by the Microsoft Partner Center for use in the Microsoft Store - it's a guid, and doesnt contain spaces.

Here is an example of how the task is used in my yaml.

- task: FlutterCommand@0
  displayName: "Create '${{ parameters.taskName }}' MSIX Content (Step 1)"
  inputs:
    projectDirectory: '$(projectDirectory)'
    arguments: 'pub run msix:build --publisher ${{ parameters.publisher }}'

When "publisher" contains spaces (e.g, MY PUBLISHER),
arguments: 'pub run msix:build --publisher MY PUBLISHER'
FlutterCommand expands the arguments string to

pub
run
msix:build
--publisher
MY
PUBLISHER

So, I need to wrap it in quotes,
arguments: 'pub run msix:build --publisher "MY PUBLISHER"'
which results in this

pub
run
msix:build
--publisher
MY PUBLISHER

Which is great, but now let's switch to the "Microsoft Store" task...
arguments: 'pub run msix:build --publisher "00000000-0000-0000-0000-000000000000"'
which results in this

pub
run
msix:build
--publisher
"00000000-0000-0000-0000-000000000000"

So, see how when an argument contains spaces, then quoting is required, and they will be stripped when passed to the final command. However, if the argument doesnt contain a space, surrounding quotes are NOT stripped, and hence will be passed into the final command.

This causes my finam AppxManifest to contain quotes in xml values that it shouldn't causing makeappx compilation errors.

I think the fix is as simple as always stripping quotes from arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant