From dd0ff150bf52e28ae3f204de3b531fc5dc7a9888 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 11 Apr 2024 14:31:43 +0800 Subject: [PATCH] Fix bug --- models/packages/package.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/models/packages/package.go b/models/packages/package.go index a3e9c739af..376157165c 100644 --- a/models/packages/package.go +++ b/models/packages/package.go @@ -247,10 +247,10 @@ func TryInsertPackage(ctx context.Context, p *Package) (*Package, error) { if err != nil { return nil, err } - if has { - return &existing, ErrDuplicatePackage + if !has { + return nil, util.ErrNotExist } - return p, nil + return &existing, nil } // DeletePackageByID deletes a package by id