Skip to content

Commit

Permalink
fix(http): preserve BodyFile absolute path
Browse files Browse the repository at this point in the history
Signed-off-by: François Samin <francois.samin@corp.ovh.com>
  • Loading branch information
fsamin committed Feb 15, 2023
1 parent 4964f01 commit eb6e8b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion executors/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ func (e Executor) getRequest(ctx context.Context, workdir string) (*http.Request
if e.Body != "" {
body = bytes.NewBuffer([]byte(e.Body))
} else if e.BodyFile != "" {
bodyfilePath := filepath.Join(workdir, e.BodyFile)
bodyfilePath := e.BodyFile
if !filepath.IsAbs(e.BodyFile) {
// Only join with the workdir with relative path
bodyfilePath = filepath.Join(workdir, e.BodyFile)
}
if _, err := os.Stat(bodyfilePath); !os.IsNotExist(err) {
temp, err := os.ReadFile(bodyfilePath)
if err != nil {
Expand Down

0 comments on commit eb6e8b6

Please sign in to comment.