This commit is contained in:
Lunny Xiao committed 2026-06-08 18:41:37 -07:00
1 parent 091ed6b756
commit 072561159d
3 files changed
+9 -7

No files matched your search

+6 -4
View File
@@ -9,6 +9,8 @@ import (
"io"
"net/http"
"net/url"
"gitea.dev/modules/util"
)
// DownloadCallback gets called for every requested LFS object to process its content
@@ -24,8 +26,8 @@ type Client interface {
Upload(ctx context.Context, objects []Pointer, callback UploadCallback) error
}
// NewClient creates a LFS client
func NewClient(endpoint *url.URL, httpTransport *http.Transport) Client {
// newClient creates a LFS client
func newClient(endpoint *url.URL, httpTransport *http.Transport) Client {
if endpoint.Scheme == "file" {
return newFilesystemClient(endpoint)
}
@@ -40,7 +42,7 @@ func NewClientFromEndpoint(cloneurl, lfsurl string, httpTransport *http.Transpor
if lfsurl != "" {
source = lfsurl
}
return nil, fmt.Errorf("unable to determine LFS endpoint from %q", source)
return nil, fmt.Errorf("unable to determine LFS endpoint from %q", util.SanitizeCredentialURLs(source))
}
return NewClient(endpoint, httpTransport), nil
return newClient(endpoint, httpTransport), nil
}
+2 -2
View File
@@ -12,11 +12,11 @@ import (
func TestNewClient(t *testing.T) {
u, _ := url.Parse("file:///test")
c := NewClient(u, nil)
c := newClient(u, nil)
assert.IsType(t, &FilesystemClient{}, c)
u, _ = url.Parse("https://test.com/lfs")
c = NewClient(u, nil)
c = newClient(u, nil)
assert.IsType(t, &HTTPClient{}, c)
}