修复 ignore 与 not found 结果不一致的问题

This commit is contained in:
dragon
2025-05-09 15:50:37 +08:00
parent b6570dea4c
commit 3467519d7a
2 changed files with 6 additions and 4 deletions

View File

@@ -148,11 +148,13 @@ func (s *Server) Serve(writer http.ResponseWriter, request *http.Request) error
if request.Method != "GET" {
return os.ErrNotExist
}
if meta.IsIgnore(meta.Path) {
var result io.ReadCloser
if meta.IgnorePath(meta.Path) {
zap.L().Debug("ignore path", zap.Any("request", request.RequestURI), zap.Any("meta.path", meta.Path))
return os.ErrNotExist
err = os.ErrNotExist
} else {
result, err = s.reader.Open(meta.Owner, meta.Repo, meta.CommitID, meta.Path)
}
result, err := s.reader.Open(meta.Owner, meta.Repo, meta.CommitID, meta.Path)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
if meta.VRoute {