From c347a072df9ba5acd8d3ce4f69dab3603e700bd4 Mon Sep 17 00:00:00 2001 From: dawn Date: Fri, 23 Oct 2026 03:15:07 +0300 Subject: [PATCH] spindle/quota: check owner and repo ids in one place Signed-off-by: dawn --- spindle/quota/quota.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spindle/quota/quota.go b/spindle/quota/quota.go index a7c2d5d31..75d7d35bc 100644 --- a/spindle/quota/quota.go +++ b/spindle/quota/quota.go @@ -152,10 +152,10 @@ func Validate(req ReserveRequest) error { if req.Identity.RepoDID == "" { return errors.New("empty repo DID") } - if !strings.HasPrefix(req.Identity.OwnerDID, "did:") { - return fmt.Errorf("invalid owner DID format: %s", req.Identity.OwnerDID) - } - if !strings.HasPrefix(req.Identity.RepoDID, "did:") { + if !req.Identity.Valid() { + if !strings.HasPrefix(req.Identity.OwnerDID, "did:") { + return fmt.Errorf("invalid owner DID format: %s", req.Identity.OwnerDID) + } return fmt.Errorf("invalid repo DID format: %s", req.Identity.RepoDID) } return nil -- 2.54.0