aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-11-02 21:42:02 -0700
committerchrislu <chris.lu@gmail.com>2022-11-02 21:42:02 -0700
commit4193dafce1282df4386b7898380af02ee7cbb657 (patch)
tree6aaa1da43b8d920ae2a055aa5194b94349790522
parentabe4a6165912983c9e5785218bf9cdd73006094c (diff)
downloadseaweedfs-4193dafce1282df4386b7898380af02ee7cbb657.tar.xz
seaweedfs-4193dafce1282df4386b7898380af02ee7cbb657.zip
azure metadata: skip metadata prefixed with "X-"
fix https://github.com/seaweedfs/seaweedfs/issues/3875
-rw-r--r--weed/remote_storage/azure/azure_storage_client.go4
-rw-r--r--weed/remote_storage/gcs/gcs_storage_client.go4
2 files changed, 8 insertions, 0 deletions
diff --git a/weed/remote_storage/azure/azure_storage_client.go b/weed/remote_storage/azure/azure_storage_client.go
index 8f28661b5..ad2bbdacb 100644
--- a/weed/remote_storage/azure/azure_storage_client.go
+++ b/weed/remote_storage/azure/azure_storage_client.go
@@ -7,6 +7,7 @@ import (
"net/url"
"os"
"reflect"
+ "strings"
"github.com/Azure/azure-storage-blob-go/azblob"
"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 {
metadata := make(map[string]string)
for k, v := range attributes {
+ if strings.HasPrefix(k, "X-") {
+ continue
+ }
metadata[k] = string(v)
}
return metadata
diff --git a/weed/remote_storage/gcs/gcs_storage_client.go b/weed/remote_storage/gcs/gcs_storage_client.go
index baeb192d8..b048effd9 100644
--- a/weed/remote_storage/gcs/gcs_storage_client.go
+++ b/weed/remote_storage/gcs/gcs_storage_client.go
@@ -6,6 +6,7 @@ import (
"io"
"os"
"reflect"
+ "strings"
"cloud.google.com/go/storage"
"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 {
metadata := make(map[string]string)
for k, v := range attributes {
+ if strings.HasPrefix(k, "X-") {
+ continue
+ }
metadata[k] = string(v)
}
return metadata