Skip to content

Commit

Permalink
fix: unable to sync files from spiders created from sub-folder of git…
Browse files Browse the repository at this point in the history
… repo
  • Loading branch information
tikazyq committed Jul 5, 2024
1 parent f4025a9 commit 059711a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/task/handler/runner_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
service2 "github.com/crawlab-team/crawlab/core/models/service"
"github.com/crawlab-team/crawlab/core/sys_exec"
"github.com/crawlab-team/crawlab/core/utils"
grpc "github.com/crawlab-team/crawlab/grpc"
"github.com/crawlab-team/crawlab/grpc"
"github.com/crawlab-team/crawlab/trace"
"github.com/shirou/gopsutil/process"
"github.com/spf13/viper"
Expand Down Expand Up @@ -414,7 +414,7 @@ func (r *RunnerV2) syncFiles() (err error) {
}
} else {
log.Infof("File needs to be synchronized: %s", path)
_err := r.downloadFile(masterURL+"/download?path="+path, filepath.Join(r.cwd, path), masterFile)
_err := r.downloadFile(masterURL+"/download?path="+filepath.Join(workingDir, path), filepath.Join(r.cwd, path), masterFile)
if _err != nil {
log.Errorf("Error downloading file: %v", _err)
err = errors.Join(err, _err)
Expand All @@ -441,6 +441,10 @@ func (r *RunnerV2) downloadFile(url string, filePath string, fileInfo *entity.Fs
log.Errorf("Error getting file response: %v", err)
return err
}
if resp.StatusCode != http.StatusOK {
log.Errorf("Error downloading file: %s", resp.Status)
return errors.New(resp.Status)
}
defer resp.Body.Close()

// create directory if not exists
Expand Down

0 comments on commit 059711a

Please sign in to comment.