diff --git a/routers/api/packages/container/manifest.go b/routers/api/packages/container/manifest.go index ad035cf473e..0503d250ce6 100644 --- a/routers/api/packages/container/manifest.go +++ b/routers/api/packages/container/manifest.go @@ -356,10 +356,6 @@ func createPackageAndVersion(ctx context.Context, mci *manifestCreationInfo, met return nil, err } - if err = packages_service.DeletePackageVersionAndReferences(ctx, pv); err != nil { - return nil, err - } - // keep download count on overwrite _pv.DownloadCount = pv.DownloadCount @@ -418,12 +414,10 @@ func createFileFromBlobReference(ctx context.Context, pv, uploadVersion *package } var err error if pf, err = packages_model.TryInsertFile(ctx, pf); err != nil { - if errors.Is(err, packages_model.ErrDuplicatePackageFile) { - // Skip this blob because the manifest contains the same filesystem layer multiple times. - return nil + if !errors.Is(err, packages_model.ErrDuplicatePackageFile) { + log.Error("Error inserting package file: %v", err) + return err } - log.Error("Error inserting package file: %v", err) - return err } props := map[string]string{ @@ -437,13 +431,6 @@ func createFileFromBlobReference(ctx context.Context, pv, uploadVersion *package } } - // Remove the file from the blob upload version - if uploadVersion != nil && ref.File.File != nil && uploadVersion.ID == ref.File.File.VersionID { - if err := packages_service.DeletePackageFile(ctx, ref.File.File); err != nil { - return err - } - } - return nil }