Skip to content

Conversation

@Ontiomacer
Copy link

@Ontiomacer Ontiomacer commented Dec 30, 2025

Proposed change

Resolves l3montree-dev/devguard #1472
l3montree-dev/devguard#1472

This PR fixes a frontend redirect issue where clicking a repository assumed a
main branch exists and redirected to /refs/main, causing a 500 error when
no default branch or refs are present.

Summary of changes

  • Removed hardcoded main branch fallback
  • Redirects now resolve in the following order:
    • repository.defaultBranch (if available)
    • first available branch
    • first available tag
  • If no refs exist, redirect is skipped entirely
  • Prevents invalid /refs/main URLs from being constructed

Testing

  • Reproduced the issue locally
  • Verified redirect logic no longer assumes a default branch
  • Full end-to-end auth testing is limited locally due to Kratos requirements

Signed-off-by: Tejas Tiwari <tt160705@outlook.com>
@Ontiomacer
Copy link
Author

Hi @Hubtrick-Git ,

I’ve opened a pull request in the devguard-web repository implementing the discussed fix.
The redirect logic now resolves refs in a safe order and skips redirecting entirely if none are available, preventing the 500 error.

Please let me know if any adjustments are needed.

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