fix: trim trailing slash from giteaURL when building review link #40
Reference in New Issue
Block a user
Delete Branch "fix/url-normalization"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Prevents double-slash in supersede URL if
GITEA_URLends with/.While browsers handle
//gracefully, malformed URLs can cause issues with URL parsers, redirect checks, and security scanners.Aligns with how
gitea.NewClientalready normalizes the base URL viastrings.TrimRight.Gpt Review
Summary
This change trims trailing slashes from Gitea URLs in supersede links, preventing malformed URLs. It is a small but robust fix and aligns with existing normalization logic.
Recommendation
APPROVE — The update is correct, safe, and idiomatic. It prevents double slashes in the constructed URL by applying strings.TrimRight to the Gitea base URL, mirroring best practices elsewhere in the codebase. All CI checks pass and there are no issues found. Approve as is.
Review by gpt
Evaluated against
50091941Security Review
Summary
This change safely trims a trailing slash from the Gitea base URL when composing the supersede link, preventing malformed double-slash URLs. It is a minimal, defensive improvement with no negative security impact.
Recommendation
APPROVE — CI passed and the modification aligns with best practices for URL normalization. From a security perspective, canonicalizing the URL reduces potential quirks in downstream URL validation or scanning. No further changes are required.
Review by security
Evaluated against
50091941Sonnet Review
Summary
The change correctly trims any trailing slash from the Gitea base URL when constructing the review link, preventing double slashes and aligning with existing client normalization. The modification is small, safe, and CI has passed.
Recommendation
APPROVE — This is a prudent, minimal fix that avoids malformed URLs without introducing risk. The code already imports and uses strings in this file, so the change integrates cleanly. No further changes are necessary.
Review by sonnet
Evaluated against
50091941