diff --git a/modules/lfs/shared.go b/modules/lfs/shared.go index 2fc9f4adf9..a4326b57b2 100644 --- a/modules/lfs/shared.go +++ b/modules/lfs/shared.go @@ -7,6 +7,8 @@ import ( "errors" "fmt" "time" + + "code.gitea.io/gitea/modules/util" ) const ( @@ -74,7 +76,7 @@ var ( // 410 - The object was removed by the owner. // 422 - Validation error. - ErrObjectNotFound = errors.New("the object does not exist on the server") + ErrObjectNotExist = util.ErrNotExist // the object does not exist on the server ErrObjectHashMismatch = errors.New("the specified hash algorithm disagrees with the server's acceptable options") ErrObjectRemoved = errors.New("the object was removed by the owner") ErrObjectValidation = errors.New("validation error") @@ -87,7 +89,7 @@ func (e *ObjectError) Error() string { func (e *ObjectError) Unwrap() error { switch e.Code { case 404: - return ErrObjectNotFound + return ErrObjectNotExist case 409: return ErrObjectHashMismatch case 410: diff --git a/modules/repository/repo.go b/modules/repository/repo.go index 9ba94e1401..3d1899b2fe 100644 --- a/modules/repository/repo.go +++ b/modules/repository/repo.go @@ -182,7 +182,7 @@ func StoreMissingLfsObjectsInRepository(ctx context.Context, repo *repo_model.Re downloadObjects := func(pointers []lfs.Pointer) error { err := lfsClient.Download(ctx, pointers, func(p lfs.Pointer, content io.ReadCloser, objectError error) error { if objectError != nil { - if errors.Is(objectError, lfs.ErrObjectNotFound) { + if errors.Is(objectError, lfs.ErrObjectNotExist) { log.Warn("Repo[%-v]: Ignore missing LFS object %-v: %v", repo, p, objectError) return nil }