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

2.296.2 Release notes #2107

Merged
merged 4 commits into from
Sep 8, 2022
Merged

2.296.2 Release notes #2107

merged 4 commits into from
Sep 8, 2022

Conversation

thboop
Copy link
Collaborator

@thboop thboop commented Sep 7, 2022

Resolves #2104 and #2103

@thboop thboop requested a review from a team as a code owner September 7, 2022 01:31
// https://docs.microsoft.com/en-us/dotnet/api/system.environment.getcommandlineargs?redirectedfrom=MSDN&view=net-6.0#remarks

// First, find any \ followed by a " and double the number of \ + 1.
value = Regex.Replace(value, @"(\\*)" + "\"", @"$1$1\" + "\"");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: formatting

Copy link
Contributor

@fhammerl fhammerl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM'

value = Regex.Replace(value, @"(\\*)" + "\"", @"$1$1\" + "\"");
// Next, what if it ends in `\`, it would escape the end quote. So, we need to detect that at the end of the string and perform the same escape
// Luckily, we can just use the $ character with detects the end of string in regex
value = Regex.Replace(value, @"(\\+)$", @"$1$1");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we compile these regexes?

@@ -6,6 +6,9 @@ namespace GitHub.Runner.Worker.Container
{
public class DockerUtil
{
private static readonly Regex QuoteEscape = new Regex(@"(\\*)" + "\"", RegexOptions.Compiled);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private static readonly Regex QuoteEscape = new Regex(@"(\\*)" + "\"", RegexOptions.Compiled);
private static readonly Regex QuoteEscape = new Regex(@"(\\*)\"", RegexOptions.Compiled);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can ignore me if the original way was for readability.

@thboop thboop merged commit 96f4f5e into releases/m296 Sep 8, 2022
@thboop thboop deleted the thboop/hotfix branch September 8, 2022 17:36
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

Successfully merging this pull request may close these issues.

None yet

3 participants