aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2022-10-01 14:33:47 +0500
committerGitHub <noreply@github.com>2022-10-01 02:33:47 -0700
commit6fa3d0cc463fd866828ee071d295eab4eb725f4b (patch)
tree1b2e928fc3d8e3cdad8890c4d28a53b37f558887
parentc3487d3da7ad97cd21b7ab7e5109ecd5d46a01cb (diff)
downloadseaweedfs-6fa3d0cc463fd866828ee071d295eab4eb725f4b.tar.xz
seaweedfs-6fa3d0cc463fd866828ee071d295eab4eb725f4b.zip
fix delete key panic of remote sync dir (#3770)
-rw-r--r--weed/command/filer_remote_sync_dir.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/weed/command/filer_remote_sync_dir.go b/weed/command/filer_remote_sync_dir.go
index 5a9170582..5bc6ae300 100644
--- a/weed/command/filer_remote_sync_dir.go
+++ b/weed/command/filer_remote_sync_dir.go
@@ -37,11 +37,16 @@ func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *sour
var lastLogTsNs = time.Now().UnixNano()
processEventFnWithOffset := pb.AddOffsetFunc(func(resp *filer_pb.SubscribeMetadataResponse) error {
- if *option.storageClass == "" {
- delete(resp.EventNotification.NewEntry.Extended, s3_constants.AmzStorageClass)
- } else {
- resp.EventNotification.NewEntry.Extended[s3_constants.AmzStorageClass] = []byte(*option.storageClass)
+ if resp.EventNotification.NewEntry != nil {
+ if *option.storageClass == "" {
+ if _, ok := resp.EventNotification.NewEntry.Extended[s3_constants.AmzStorageClass]; ok {
+ delete(resp.EventNotification.NewEntry.Extended, s3_constants.AmzStorageClass)
+ }
+ } else {
+ resp.EventNotification.NewEntry.Extended[s3_constants.AmzStorageClass] = []byte(*option.storageClass)
+ }
}
+
processor.AddSyncJob(resp)
return nil
}, 3*time.Second, func(counter int64, lastTsNs int64) error {