diff --git a/main.go b/main.go index 25d16e1..a846d65 100644 --- a/main.go +++ b/main.go @@ -45,14 +45,20 @@ func (w *IpfsMultipartWriter) CreateIpfsDirectoryPart(name string) (io.Writer, e return w.CreatePart(h) } -func (w *IpfsMultipartWriter) CreateIpfsFilePart(absPath, name string) (io.Writer, error) { +func (w *IpfsMultipartWriter) CreateIpfsFilePart(name string) (io.Writer, error) { + h := make(textproto.MIMEHeader) + h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="file"; filename="%s"`, escapeQuotes(name))) + h.Set("Content-Type", "application/octet-stream") + return w.CreatePart(h) +} + +func (w *IpfsMultipartWriter) CreateIpfsAbsFilePart(name, absPath string) (io.Writer, error) { h := make(textproto.MIMEHeader) h.Set("AbsPath", absPath) h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="file"; filename="%s"`, escapeQuotes(name))) h.Set("Content-Type", "application/octet-stream") return w.CreatePart(h) } - func main() { githubactions.Infof("Checking inputs...") @@ -122,12 +128,7 @@ func main() { return nil } - absPath, err := filepath.Rel(path, innerPath) - if err != nil { - return err - } - - w, err = mwriter.CreateIpfsFilePart(fmt.Sprintf("/%v", absPath), innerPath) + w, err = mwriter.CreateIpfsFilePart(innerPath) if err != nil { return err }