reconcile(github): sync GitHub-only commits into Gitea main (#144) #6

Merged
eSlider merged 9 commits from reconcile/github-sync#144 into main 2026-08-23 19:55:48 +01:00
Showing only changes of commit ecf34ba51a - Show all commits
+12 -2
View File
@@ -319,8 +319,18 @@ func (c *Client) resolveAPIURL(ref string) string {
if ref == "" { if ref == "" {
return ref return ref
} }
if strings.HasPrefix(ref, "http://") || strings.HasPrefix(ref, "https://") { // Rewrite any host to the configured API base so downloads stay on the
return ref // internal network and keep the Authorization header (no cross-host
// redirect that would strip it). Scheme-relative URLs are handled too.
if strings.HasPrefix(ref, "//") {
ref = "http:" + ref
}
if u, err := url.Parse(ref); err == nil && u.IsAbs() {
if base, err2 := url.Parse(c.baseURL()); err2 == nil {
u.Scheme = base.Scheme
u.Host = base.Host
return u.String()
}
} }
base := c.baseURL() base := c.baseURL()
if strings.HasPrefix(ref, "/") { if strings.HasPrefix(ref, "/") {