Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hantonelli committed Mar 10, 2019
1 parent be8d6d1 commit 239bc46
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions handler/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ func processMultipart(r *http.Request, request *params) error {
return errors.New("map form field could not be decoded")
}

// Read form files and add them to operations variables
var upload graphql.Upload
for key, path := range uploadsMap {
file, header, err := r.FormFile(key)
Expand All @@ -525,11 +526,9 @@ func processMultipart(r *http.Request, request *params) error {
Size: header.Size,
Filename: header.Filename,
}

if len(path) != 1 || !strings.HasPrefix(path[0], variablePrefix) {
return errors.New(fmt.Sprintf("invalid value for key %s", key))
}

addUploadToOperations(operations, upload, path[0])
}

Expand Down

0 comments on commit 239bc46

Please sign in to comment.