Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 24, 2025

Two string manipulation bugs in DiagnosticLinkInlineParser.cs:

Changes

  • Line 275: Added missing closing backtick in error message

    - processor.EmitError(link, $"`{url}` does not exist. If it was recently removed add a redirect. resolved to `{pathOnDisk}");
    + processor.EmitError(link, $"`{url}` does not exist. If it was recently removed add a redirect. resolved to `{pathOnDisk}`");
  • Line 343: Fixed incorrect variable reference in LastIndexOf call

    - : newUrl.Remove(url.LastIndexOf(".md", StringComparison.Ordinal), ".md".Length);
    + : newUrl.Remove(newUrl.LastIndexOf(".md", StringComparison.Ordinal), ".md".Length);

    Using url instead of newUrl caused incorrect index calculation when removing .md extensions from modified URLs.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • d31bhlox0wglh.cloudfront.net
    • Triggering command: /home/REDACTED/work/docs-builder/docs-builder/.artifacts/bin/Elastic.ApiExplorer.Tests/release/Elastic.ApiExplorer.Tests /home/REDACTED/work/docs-builder/docs-builder/.artifacts/bin/Elastic.ApiExplorer.Tests/release/Elastic.ApiExplorer.Tests @@ /tmp/tmp041fVD.tmp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt
Please apply the following diffs and create a pull request.
Once the PR is ready, give it a title based on the messages of the fixes being applied.

[{"message":"Missing closing backtick in the error message. The string should end with `{pathOnDisk}`.","fixFiles":[{"filePath":"src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs","diff":"diff --git a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs\n--- a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs\n+++ b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs\n@@ -272,7 +272,7 @@\n \t\t\t\tprocessor.EmitWarning(link, $\"Local file `{url}` has a redirect, please update this reference to: {name}\");\n \t\t\t}\n \t\t\telse\n-\t\t\t\tprocessor.EmitError(link, $\"`{url}` does not exist. If it was recently removed add a redirect. resolved to `{pathOnDisk}\");\n+\t\t\t\tprocessor.EmitError(link, $\"`{url}` does not exist. If it was recently removed add a redirect. resolved to `{pathOnDisk}`\");\n \n \t\t}\n \t}\n"}]},{"message":"Using `url` instead of `newUrl` for LastIndexOf is incorrect. This should be `newUrl.LastIndexOf(\".md\", StringComparison.Ordinal)` to maintain consistency with the variable being modified.","fixFiles":[{"filePath":"src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs","diff":"diff --git a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs\n--- a/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs\n+++ b/src/Elastic.Markdown/Myst/InlineParsers/DiagnosticLinkInlineParser.cs\n@@ -340,7 +340,7 @@\n \t\t{\n \t\t\tnewUrl = newUrl.EndsWith($\"{Path.DirectorySeparatorChar}index.md\")\n \t\t\t\t? newUrl.Remove(newUrl.LastIndexOf(\"index.md\", StringComparison.Ordinal), \"index.md\".Length)\n-\t\t\t\t: newUrl.Remove(url.LastIndexOf(\".md\", StringComparison.Ordinal), \".md\".Length);\n+\t\t\t\t: newUrl.Remove(newUrl.LastIndexOf(\".md\", StringComparison.Ordinal), \".md\".Length);\n \t\t}\n \n \t\t// TODO this is hardcoded should be part of extension system\n"}]}]

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix missing closing backtick in error message Fix missing backtick and incorrect variable in DiagnosticLinkInlineParser Nov 24, 2025
Copilot AI requested a review from reakaleek November 24, 2025 12:27
Copilot finished work on behalf of reakaleek November 24, 2025 12:27
@github-actions
Copy link

Label error. Requires exactly 1 of: automation, breaking, bug, changelog:skip, chore, ci, dependencies, documentation, enhancement, feature, fix, redesign. Found:

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.

3 participants