Skip to content

Commit 91ee467

Browse files
committed
Escaping backslashes when writing Firefox preferences to profile in .NET
Fixes issue #3283.
1 parent a90c645 commit 91ee467

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dotnet/src/webdriver/Firefox/Preferences.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ internal void WriteToFile(string filePath)
141141
{
142142
foreach (KeyValuePair<string, string> preference in this.preferences)
143143
{
144-
writer.WriteLine(string.Format(CultureInfo.InvariantCulture, "user_pref(\"{0}\", {1});", preference.Key, preference.Value));
144+
string escapedValue = preference.Value.Replace(@"\", @"\\");
145+
writer.WriteLine(string.Format(CultureInfo.InvariantCulture, "user_pref(\"{0}\", {1});", preference.Key, escapedValue));
145146
}
146147
}
147148
}

0 commit comments

Comments
 (0)