From 5d9cfaa97375f6ec3216cd494672201508043b60 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Wed, 28 Jan 2026 13:46:27 +0800 Subject: [PATCH] fix(eventhub): nil pointer trying get owner --- assets | 2 +- pkg/filemanager/eventhub/subscriber.go | 10 +++++++++- service/oauth/oauth.go | 7 ------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/assets b/assets index c0f3e502..b900a868 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit c0f3e50207b5783220fafc26a0c9885aadd38af1 +Subproject commit b900a868aa9ab09df7876feb6ac2de40b3be23ae diff --git a/pkg/filemanager/eventhub/subscriber.go b/pkg/filemanager/eventhub/subscriber.go index c5c36b24..28583482 100644 --- a/pkg/filemanager/eventhub/subscriber.go +++ b/pkg/filemanager/eventhub/subscriber.go @@ -108,6 +108,10 @@ func (s *subscriber) Owner() (*ent.User, error) { s.mu.Lock() defer s.mu.Unlock() + return s.ownerLocked() +} + +func (s *subscriber) ownerLocked() (*ent.User, error) { if time.Since(s.cachedAt) > userCacheTTL || s.ownerCached == nil { user, err := s.userClient.GetLoginUserByID(context.Background(), s.uid) if err != nil { @@ -165,7 +169,11 @@ func (s *subscriber) flushLocked(ctx context.Context) { } if !s.online { - _ = s.fsEventClient.Create(ctx, s.ownerCached.ID, uuid.FromStringOrNil(s.id), lo.Map(s.buffer, func(item *Event, index int) string { + owner, err := s.ownerLocked() + if err != nil { + return + } + _ = s.fsEventClient.Create(ctx, owner.ID, uuid.FromStringOrNil(s.id), lo.Map(s.buffer, func(item *Event, index int) string { res, _ := json.Marshal(item) return string(res) })...) diff --git a/service/oauth/oauth.go b/service/oauth/oauth.go index 94c79de4..719c7339 100644 --- a/service/oauth/oauth.go +++ b/service/oauth/oauth.go @@ -246,13 +246,6 @@ func (s *DeleteOAuthGrantService) Delete(c *gin.Context) error { return serializer.NewError(serializer.CodeNotFound, "OAuth grant not found", nil) } - dep.AuditRecorder().Record(c, &types.LogEntry{ - Category: types.AuditLogTypeOAuthGrantRevoke, - Exts: map[string]string{ - "client_id": s.AppID, - }, - }) - return nil }