diff --git a/src/GitHub.App/Services/PullRequestEditorService.cs b/src/GitHub.App/Services/PullRequestEditorService.cs
index 9824f0f0ce..50bf091988 100644
--- a/src/GitHub.App/Services/PullRequestEditorService.cs
+++ b/src/GitHub.App/Services/PullRequestEditorService.cs
@@ -219,10 +219,10 @@ await pullRequestService.ExtractToTempFile(
frame = VisualStudio.Services.DifferenceService.OpenComparisonWindow2(
leftFile,
rightFile,
- caption,
- tooltip,
- leftLabel,
- rightLabel,
+ SanitizeForDisplay(caption),
+ SanitizeForDisplay(tooltip),
+ SanitizeForDisplay(leftLabel),
+ SanitizeForDisplay(rightLabel),
string.Empty,
string.Empty,
(uint)options);
@@ -284,6 +284,13 @@ await pullRequestService.ExtractToTempFile(
}
}
+ private static string SanitizeForDisplay(string caption)
+ {
+ // The diff window passes captions and tooltips through string.Format, with {0} and {1} being the left and right file respectively, but we already
+ // nicely format the file names with extra info we know, so we have to escape braces to prevent unwanted formatting, or invalid format errors.
+ return caption.Replace("{", "{{").Replace("}", "}}");
+ }
+
///
public Task OpenDiff(
IPullRequestSession session,