Skip to content

Conversation

@stunningpixels
Copy link
Contributor

@stunningpixels stunningpixels commented Dec 16, 2025

Summary

Fixes an issue where the GitHub PR link at the top of the review page would open incorrectly when the stored URL lacked the https:// protocol prefix.

Problem

When a GitHub PR URL was submitted without the protocol prefix (e.g., github.com/owner/repo/pull/123 instead of https://github.com/owner/repo/pull/123), the link would open as a relative path, resulting in broken URLs like https://api.vibekanban.com/review/github.com/... instead of navigating to GitHub.

Solution

Added URL normalization in the backend's init_review_upload handler to ensure all GitHub PR URLs are stored with the https:// prefix:

  • Added normalize_github_url() helper function that:
    • Trims whitespace from the URL
    • Checks if URL already has http:// or https:// prefix
    • Prepends https:// if no protocol is present
  • Applied normalization before storing the URL in the database

Why Backend?

  • Single point of fix: All clients benefit from the fix
  • Data consistency: Database always contains properly formatted URLs
  • Defense in depth: Frontend shouldn't need to handle malformed data from the API

This PR was written using Vibe Kanban

## Summary

I added URL normalization to the backend in `vibe-kanban/crates/remote/src/routes/review.rs`:

1. **Added `normalize_github_url` helper function** (lines 129-137) - Checks if the URL already has `http://` or `https://` prefix, and if not, prepends `https://`

2. **Applied normalization in `init_review_upload`** (lines 217-218) - The URL is now normalized before being stored in the database

This ensures that all GitHub PR URLs stored in the database will have the correct `https://` protocol prefix, preventing the browser from treating them as relative paths when used in `<a href>` attributes.
@vibe-kanban-cloud
Copy link

Vibe Kanban Review Failed

Unfortunately, the code review could not be completed.

Review ID: 261d0958-cc53-4a14-8a64-fd8ab238f4e0

@stunningpixels stunningpixels changed the title Link at top of page doesn't open correctly (vibe-kanban) Fix GitHub PR link opening incorrectly when URL lacks protocol prefix (Vibe Kanban) Dec 16, 2025
@vibe-kanban-cloud
Copy link

Vibe Kanban Review Failed

Unfortunately, the code review could not be completed.

Review ID: 261d0958-cc53-4a14-8a64-fd8ab238f4e0

2 similar comments
@vibe-kanban-cloud
Copy link

Vibe Kanban Review Failed

Unfortunately, the code review could not be completed.

Review ID: 261d0958-cc53-4a14-8a64-fd8ab238f4e0

@vibe-kanban-cloud
Copy link

Vibe Kanban Review Failed

Unfortunately, the code review could not be completed.

Review ID: 261d0958-cc53-4a14-8a64-fd8ab238f4e0

@stunningpixels stunningpixels merged commit d58211f into main Dec 16, 2025
2 checks passed
@stunningpixels stunningpixels deleted the vk/a6fb-link-at-top-of-p branch December 16, 2025 16:07
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