Browse Source

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.
pull/8560/head
Chris Lu 1 day ago
parent
commit
41c07ba168
  1. 9
      weed/s3api/auth_credentials_subscribe.go

9
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
}

Loading…
Cancel
Save