-
Notifications
You must be signed in to change notification settings - Fork 925
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
2.296.2 Release notes #2107
Conversation
374a7e3
to
1ceed23
Compare
b6b210e
to
e7e4f21
Compare
// 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\" + "\""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: formatting
There was a problem hiding this 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"); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static readonly Regex QuoteEscape = new Regex(@"(\\*)" + "\"", RegexOptions.Compiled); | |
private static readonly Regex QuoteEscape = new Regex(@"(\\*)\"", RegexOptions.Compiled); |
There was a problem hiding this comment.
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.
Resolves #2104 and #2103