From cd573483ea1e3b5d3054c78f835d3053dc4c217b Mon Sep 17 00:00:00 2001 From: dragon Date: Tue, 27 Jan 2026 17:32:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=AC=E5=9C=B0=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E8=B7=AF=E7=94=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/local/main.go | 3 +-- pkg/providers/local.go | 10 +++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cmd/local/main.go b/cmd/local/main.go index 96e3a5b..9d17cf2 100644 --- a/cmd/local/main.go +++ b/cmd/local/main.go @@ -38,7 +38,6 @@ func init() { zap.ReplaceGlobals(logger) dir, _ := os.Getwd() path = dir - zap.L().Info("exec workdir", zap.String("path", path)) flag.StringVar(&org, "org", org, "org") flag.StringVar(&repo, "repo", repo, "repo") flag.StringVar(&domain, "domain", domain, "domain") @@ -48,7 +47,7 @@ func init() { } func main() { - fmt.Printf("请访问 http://%s%s/", repo, port) + fmt.Printf("请访问 http://%s%s/ ,本地路径: %s", repo, port, path) if stat, err := os.Stat(path); err != nil || !stat.IsDir() { zap.L().Fatal("path is not a directory", zap.String("path", path)) } diff --git a/pkg/providers/local.go b/pkg/providers/local.go index 8d2410a..ddd3a35 100644 --- a/pkg/providers/local.go +++ b/pkg/providers/local.go @@ -10,6 +10,7 @@ import ( "net/http/httptest" "os" "path/filepath" + "slices" "strconv" "strings" "time" @@ -42,7 +43,14 @@ func (l *LocalProvider) Close() error { return nil } -func (l *LocalProvider) Meta(_ context.Context, _, _ string) (*core.Metadata, error) { +func (l *LocalProvider) Meta(_ context.Context, owner, repo string) (*core.Metadata, error) { + if _, ok := l.graph[owner]; !ok { + return nil, os.ErrNotExist + } + if !slices.Contains(l.graph[owner], repo) { + return nil, os.ErrNotExist + } + return &core.Metadata{ ID: "localhost", LastModified: time.Now(),