Skip to content

Commit

Permalink
Fix upload handler to handle form-data
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Apr 5, 2021
1 parent 4ab24f7 commit f4539f3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Go/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,21 @@ func (gz GzipReader) Close() error {

// UploadHandler uploads TF models into the server
func UploadHandler(w http.ResponseWriter, r *http.Request) {
if r.FormValue("model") == "model" {
var uploadForm bool
for key, values := range r.Header {
if strings.ToLower(key) == "content-type" {
for _, v := range values {
if strings.Contains(strings.ToLower(v), "form-data") {
uploadForm = true
break
}
}
}
if uploadForm {
break
}
}
if uploadForm {
// we received request for upload via form values
UploadFormHandler(w, r)
return
Expand Down

0 comments on commit f4539f3

Please sign in to comment.