Commit e62e1226 authored by Jack Pearkes's avatar Jack Pearkes

post-processor/vagrant-cloud: fix multi-part corruption

parent 4ea700d7
...@@ -6,11 +6,9 @@ import ( ...@@ -6,11 +6,9 @@ import (
"fmt" "fmt"
"io" "io"
"log" "log"
"mime/multipart"
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
"path/filepath"
"strings" "strings"
) )
...@@ -113,13 +111,8 @@ func (v VagrantCloudClient) Upload(path string, url string) (*http.Response, err ...@@ -113,13 +111,8 @@ func (v VagrantCloudClient) Upload(path string, url string) (*http.Response, err
defer file.Close() defer file.Close()
body := &bytes.Buffer{} body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
part, err := writer.CreateFormFile("file", filepath.Base(path))
if err != nil {
return nil, err
}
_, err = io.Copy(part, file) _, err = io.Copy(body, file)
if err != nil { if err != nil {
return nil, fmt.Errorf("Error uploading file: %s", err) return nil, fmt.Errorf("Error uploading file: %s", err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment