Skip to content

batches: fix exclude repo from workspaces when query is quoted

Warren Gifford requested to merge kr/exclude-repo-string-fix into main

Created by: courier-new

The SSBC editor currently throws an error if you try to use the "exclude repo" button from the workspaces preview if your repo query value is quoted. For example, in the following batch spec:

name: test-1234
description: Add Hello World to READMEs
on:
  - repositoriesMatchingQuery: "file:README.md count:10"
...

Trying to exclude a single repo would throw this error:

Unable to update batch spec. Double-check to make sure there are no syntax errors, then try again.Could not parse spec after updating "repositoriesMatchingQuery"

This was due to the interpretation of the escape character sequence, which we were applying to the value regardless of whether or not it was quoted. So it would try to add, for example:

Screen Shot 2022-01-19 at 1 35 23 PM

which would produce a syntax error.

This PR updates it to only escapes the "-repo:" qualifier if the query value is not quoted, and adds another test.

Merge request reports

Loading