Skip to content

Ensure Powershell file variables contain no BOM

What does this MR do?

Powershell writes file variables (variables defined as a 'file' in the GitLab UI setting) using Set-Content.

Set-Content allows a -Encoding flag, but it's difficult to specify a consistent encoding that does not include a BOM across different versions of PowerShell.

To remedy this, System.IO.File]::WriteAllText is used instead.

Why was this MR needed?

Files written should be identical to the user input. PowerShell was prepending a BOM to the written file.

What's the best way to test this MR?

Running the test TestDockerCommandSuccessRunFileVariable on Windows performs a checksum on the file output to ensure it's identical to the input.

What are the relevant issue numbers?

Closes #4818 (closed)

Closes #2173 (closed)

Closes #4814 (closed)

Merge request reports