From 63d9bb626a3ffc876053ecec7358badaf8ff8dc8 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Sun, 4 Dec 2016 19:30:52 +0100 Subject: [PATCH] postform: fix check when ${filename} is provided (#3391) Checking key condition when ${filename} is provided wasn't working well, this patch fixes the wrong behavior --- cmd/bucket-handlers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/bucket-handlers.go b/cmd/bucket-handlers.go index 4c0eaa118..c5344227a 100644 --- a/cmd/bucket-handlers.go +++ b/cmd/bucket-handlers.go @@ -374,13 +374,13 @@ func (api objectAPIHandlers) PostPolicyBucketHandler(w http.ResponseWriter, r *h } bucket := mux.Vars(r)["bucket"] formValues["Bucket"] = bucket - object := formValues["Key"] - if fileName != "" && strings.Contains(object, "${filename}") { + if fileName != "" && strings.Contains(formValues["Key"], "${filename}") { // S3 feature to replace ${filename} found in Key form field // by the filename attribute passed in multipart - object = strings.Replace(object, "${filename}", fileName, -1) + formValues["Key"] = strings.Replace(formValues["Key"], "${filename}", fileName, -1) } + object := formValues["Key"] // Verify policy signature. apiErr := doesPolicySignatureMatch(formValues)