Remove abs path
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 53s

This commit is contained in:
Alexandre Bruyant 2024-01-07 18:08:00 +01:00
parent d67b490947
commit 6b4eec8251

17
main.go
View File

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