good morning!!!!

Skip to content
Commits on Source (1)
......@@ -11,19 +11,20 @@ import (
func makeFormData(
filename, mimeType string,
content []byte,
) (formData *bytes.Buffer, err error) {
) (formData *bytes.Buffer, contentType string, err error) {
buf := new(bytes.Buffer)
writer := multipart.NewWriter(buf)
defer writer.Close()
part, err := createFormFile(writer, "file", filename, mimeType)
if err != nil {
return buf, err
return buf, contentType, err
}
_, err = part.Write(content)
if err != nil {
return buf, err
return buf, contentType, err
}
return buf, err
contentType = writer.FormDataContentType()
return buf, contentType, err
}
func createFormFile(writer *multipart.Writer, fieldname, filename, mime string) (io.Writer, error) {
......
......@@ -88,7 +88,7 @@ func (F *Client) Push(
contentType = http.DetectContentType(dat)
}
sum := meow.Checksum64(constants.THREEBEEF, dat)
d, err := makeFormData(normalizeName(file), contentType, dat)
d, contentType, err := makeFormData(normalizeName(file), contentType, dat)
if err != nil {
return nil, nil, err
}
......
......@@ -67,12 +67,12 @@ func (O *FS) Open(name string) (filing.HashedFile, error) {
}
meta, err := O.c.Meta(out.path + "?metadata=true")
if err != nil {
return nil, err
return out, err
}
if fl, ok := meta.Sys().(*api_weed.WeedFileMeta); ok {
out.hash, err = strconv.ParseUint(fl.Extended.Meow64, 10, 64)
if err != nil {
return nil, err
return out, err
}
}
return out, nil
......