From 41c07ba1686ed648dd32b62393db323b2c8f22ff Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 8 Mar 2026 22:55:48 -0700 Subject: [PATCH] fix: handle cross-directory moves in IAM config subscription When a file is moved out of an IAM directory (e.g., /etc/iam/groups), the dir variable was overwritten with NewParentPath, causing the source directory change to be missed. Now also notifies handlers about the source directory for cross-directory moves. --- weed/s3api/auth_credentials_subscribe.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/weed/s3api/auth_credentials_subscribe.go b/weed/s3api/auth_credentials_subscribe.go index e491ee6a1..38aacc768 100644 --- a/weed/s3api/auth_credentials_subscribe.go +++ b/weed/s3api/auth_credentials_subscribe.go @@ -19,7 +19,9 @@ func (s3a *S3ApiServer) subscribeMetaEvents(clientName string, lastTsNs int64, p message := resp.EventNotification - // For rename/move operations, NewParentPath contains the destination directory + // For rename/move operations, NewParentPath contains the destination directory. + // We process both source and destination dirs so moves out of watched + // directories (e.g., IAM config dirs) are not missed. dir := resp.Directory if message.NewParentPath != "" { dir = message.NewParentPath @@ -31,6 +33,11 @@ func (s3a *S3ApiServer) subscribeMetaEvents(clientName string, lastTsNs int64, p _ = s3a.onIamConfigChange(dir, message.OldEntry, message.NewEntry) _ = s3a.onCircuitBreakerConfigChange(dir, message.OldEntry, message.NewEntry) + // For moves across directories, also notify handlers about the source directory + if message.NewParentPath != "" && resp.Directory != message.NewParentPath { + _ = s3a.onIamConfigChange(resp.Directory, message.OldEntry, message.NewEntry) + } + return nil }