Skip to content

Commit 61df725

Browse files
jamesadevineCopilot
andcommitted
fix: setOutput value escaping and CI trigger path coverage
Use escapeMessage instead of escapeProperty for setOutput value — the value is in the message body (after closing ]) where ] and ; are not escaped. Also add trigger_filters.rs to ado-script workflow paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 284806b commit 61df725

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

.github/workflows/ado-script.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
paths:
66
- "scripts/ado-script/**"
77
- "src/compile/filter_ir.rs"
8+
- "src/compile/extensions/trigger_filters.rs"
89
- "Cargo.toml"
910
- "Cargo.lock"
1011
- ".github/workflows/ado-script.yml"

scripts/ado-script/src/shared/__tests__/vso-logger.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ describe("vso-logger", () => {
2323
]);
2424
});
2525

26-
it("setOutput escapes ; in name and ] in value", () => {
26+
it("setOutput escapes ; in name and passes ] through in value", () => {
2727
setOutput("a;b", "v]w");
2828
expect(writes[0]).toContain("variable=a%3Bb");
29-
expect(writes[0]).toContain("]v%5Dw\n");
29+
// Value is in the message body (after closing ]), so ] is NOT escaped
30+
expect(writes[0]).toContain("]v]w\n");
3031
});
3132

3233
it("addBuildTag emits a build tag command with message escaping", () => {

scripts/ado-script/src/shared/vso-logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function emit(line: string): void {
3131

3232
export function setOutput(name: string, value: string): void {
3333
const safeName = escapeProperty(name);
34-
const safeValue = escapeProperty(value);
34+
const safeValue = escapeMessage(value);
3535
emit(`##vso[task.setvariable variable=${safeName};isOutput=true]${safeValue}`);
3636
}
3737

0 commit comments

Comments
 (0)