Browse Source

azure metadata: skip metadata prefixed with "X-"

fix https://github.com/seaweedfs/seaweedfs/issues/3875
pull/3947/head
chrislu 2 years ago
parent
commit
4193dafce1
  1. 4
      weed/remote_storage/azure/azure_storage_client.go
  2. 4
      weed/remote_storage/gcs/gcs_storage_client.go

4
weed/remote_storage/azure/azure_storage_client.go

@ -7,6 +7,7 @@ import (
"net/url" "net/url"
"os" "os"
"reflect" "reflect"
"strings"
"github.com/Azure/azure-storage-blob-go/azblob" "github.com/Azure/azure-storage-blob-go/azblob"
"github.com/seaweedfs/seaweedfs/weed/filer" "github.com/seaweedfs/seaweedfs/weed/filer"
@ -187,6 +188,9 @@ func (az *azureRemoteStorageClient) readFileRemoteEntry(loc *remote_pb.RemoteSto
func toMetadata(attributes map[string][]byte) map[string]string { func toMetadata(attributes map[string][]byte) map[string]string {
metadata := make(map[string]string) metadata := make(map[string]string)
for k, v := range attributes { for k, v := range attributes {
if strings.HasPrefix(k, "X-") {
continue
}
metadata[k] = string(v) metadata[k] = string(v)
} }
return metadata return metadata

4
weed/remote_storage/gcs/gcs_storage_client.go

@ -6,6 +6,7 @@ import (
"io" "io"
"os" "os"
"reflect" "reflect"
"strings"
"cloud.google.com/go/storage" "cloud.google.com/go/storage"
"github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/glog"
@ -166,6 +167,9 @@ func (gcs *gcsRemoteStorageClient) readFileRemoteEntry(loc *remote_pb.RemoteStor
func toMetadata(attributes map[string][]byte) map[string]string { func toMetadata(attributes map[string][]byte) map[string]string {
metadata := make(map[string]string) metadata := make(map[string]string)
for k, v := range attributes { for k, v := range attributes {
if strings.HasPrefix(k, "X-") {
continue
}
metadata[k] = string(v) metadata[k] = string(v)
} }
return metadata return metadata

Loading…
Cancel
Save