Skip to content

Commit

Permalink
Parse form
Browse files Browse the repository at this point in the history
  • Loading branch information
anbsky committed Mar 24, 2021
1 parent 0553c71 commit e5ac60e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/publish/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,17 @@ func (h Handler) createFile(userID int, origFilename string) (*os.File, error) {
func (h Handler) fetchFile(r *http.Request, userID int) (*os.File, error) {
log := logger.WithFields(logrus.Fields{"user_id": userID, "method_handler": method})

err := r.ParseMultipartForm(32 << 20)
if err != nil {
return nil, err
}

url := r.Form.Get(remoteURLParam)
if url == "" {
return nil, ErrEmptyRemoteURL
}

r, err := http.NewRequest(http.MethodGet, url, nil)
r, err = http.NewRequest(http.MethodGet, url, nil)
if err != nil {
return nil, werrors.Wrap(err, "error creating request")
}
Expand Down

0 comments on commit e5ac60e

Please sign in to comment.