Skip to content

Conversation

@mustansir14
Copy link
Contributor

Description:

This PR fixes a bug with link generation for GH wiki pages.

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

@mustansir14 mustansir14 requested a review from a team November 5, 2025 07:36
@mustansir14 mustansir14 requested review from a team as code owners November 5, 2025 07:36
kashifkhan0771
kashifkhan0771 previously approved these changes Nov 5, 2025
if line > 0 {
baseLink += "#L" + strconv.FormatInt(line, 10)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I know I'm being persnickety but this newline is bugging me :/

// GitHub Wiki links are formatted differently
baseLink = repo[:len(repo)-9] + "/wiki/"
if file != "" {
baseLink += strings.TrimSuffix(file, ".md") + "/"
Copy link
Contributor

Choose a reason for hiding this comment

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

This assumes that if file is empty, the actual file we care about is a markdown file, right? That seems very specific. How do we know that?

In any case, this seems like something that should be explained in a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for this comment because my assumption was that wiki documents can only be created in markdown format, but it turns out github supports all of these:
image

Even though markdown is set by default and most wikis would be using markdown, best solution would be to just remove the file extension, whatever it is. I'll do that

Comment on lines +170 to +175
if commit != "" {
baseLink += commit
}
if line > 0 {
baseLink += "#L" + strconv.FormatInt(line, 10)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If these are real possibilities, I think they should have test cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

@mustansir14 mustansir14 requested a review from rosecodym November 7, 2025 07:57
Copy link
Contributor

@rosecodym rosecodym left a comment

Choose a reason for hiding this comment

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

I am taking it on faith that the base link mangling is correct, but you're the expert here!

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