aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/packages/container/blob.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/packages/container/blob.go')
-rw-r--r--routers/api/packages/container/blob.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/api/packages/container/blob.go b/routers/api/packages/container/blob.go
index f0457c55e1..c8e8dd0545 100644
--- a/routers/api/packages/container/blob.go
+++ b/routers/api/packages/container/blob.go
@@ -27,10 +27,6 @@ var uploadVersionMutex sync.Mutex
// saveAsPackageBlob creates a package blob from an upload
// The uploaded blob gets stored in a special upload version to link them to the package/image
func saveAsPackageBlob(hsr packages_module.HashedSizeReader, pci *packages_service.PackageCreationInfo) (*packages_model.PackageBlob, error) {
- if err := packages_service.CheckSizeQuotaExceeded(db.DefaultContext, pci.Creator, pci.Owner, packages_model.TypeContainer, hsr.Size()); err != nil {
- return nil, err
- }
-
pb := packages_service.NewPackageBlob(hsr)
exists := false
@@ -43,6 +39,10 @@ func saveAsPackageBlob(hsr packages_module.HashedSizeReader, pci *packages_servi
}
err = db.WithTx(db.DefaultContext, func(ctx context.Context) error {
+ if err := packages_service.CheckSizeQuotaExceeded(ctx, pci.Creator, pci.Owner, packages_model.TypeContainer, hsr.Size()); err != nil {
+ return err
+ }
+
pb, exists, err = packages_model.GetOrInsertBlob(ctx, pb)
if err != nil {
log.Error("Error inserting package blob: %v", err)