Skip to content

Conversation

@boostvolt
Copy link

NormalizePathPrefix("") returns / for empty prefix, but URL construction appends /api/..., resulting in //api/health-checks/complete. This causes unnecessary 301 redirects on every health check.

Now returning "" for empty/root prefix instead of /.

Copilot AI review requested due to automatic review settings January 13, 2026 19:03
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes a double slash issue in URLs when using an empty/root path prefix. The problem occurred because NormalizePathPrefix("") returned "/", which when concatenated with /api/... resulted in //api/..., causing unnecessary 301 redirects.

Changes:

  • Modified NormalizePathPrefix to return empty string for root paths ("" or "/") instead of "/"
  • Updated URL construction and conditional checks throughout the codebase to work with the new normalization behavior
  • Fixed a pre-existing bug where NormalizePathPrefix would return without trimming trailing slashes when adding a leading slash

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
handler.go Updated NormalizePathPrefix function to return empty string for root paths, simplified prefix assignment after normalization, updated middleware condition to check for empty string instead of "/", and fixed a bug in path prefix normalization logic
internal/riveruicmd/riveruicmd.go Simplified health check URL construction by removing redundant TrimSuffix call since normalized prefix never has trailing slashes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant