1
0
mirror of https://github.com/minio/mc.git synced 2025-11-10 13:42:32 +03:00

Copy metadata during mirror and cp peration (#2347)

Validate metadata key/values to filter out custom xattr
set on fs to prevent invalid http headers being sent in http request
by minio-go
This commit is contained in:
poornas
2018-01-10 11:03:42 -08:00
committed by kannappanr
parent 13259eea21
commit b64c8a3aa9
35 changed files with 20811 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ import (
"strings"
"github.com/minio/mc/pkg/probe"
"golang.org/x/net/lex/httplex"
)
// Check if the passed URL represents a folder. It may or may not exist yet.
@@ -87,12 +88,15 @@ func getSourceStream(alias string, urlStr string, fetchStat bool) (reader io.Rea
}
metadata = map[string]string{}
if fetchStat {
st, err := sourceClnt.Stat(false, false)
st, err := sourceClnt.Stat(false, true)
if err != nil {
return nil, nil, err.Trace(alias, urlStr)
}
for k, v := range st.Metadata {
metadata[k] = v
if httplex.ValidHeaderFieldName(k) &&
httplex.ValidHeaderFieldValue(v) {
metadata[k] = v
}
}
}
return reader, metadata, nil