Skip to content

Commit

Permalink
Wrap devpodignore with nil check on workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
bkneis authored and pascalbreuninger committed Nov 1, 2024
1 parent 0a539e4 commit 8c49c5e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/agent/tunnelserver/tunnelserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,16 +419,18 @@ func (t *tunnelServer) StreamMount(message *tunnel.StreamMountRequest, stream tu

// Get .devpodignore files to exclude
excludes := []string{}
f, err := os.Open(filepath.Join(t.workspace.Source.LocalFolder, ".devpodignore"))
if err == nil {
excludes, err = dockerignore.ReadAll(f)
if err != nil {
t.log.Warnf("Error reading .devpodignore file: %v", err)
if t.workspace != nil {
f, err := os.Open(filepath.Join(t.workspace.Source.LocalFolder, ".devpodignore"))
if err == nil {
excludes, err = dockerignore.ReadAll(f)
if err != nil {
t.log.Warnf("Error reading .devpodignore file: %v", err)
}
}
}

buf := bufio.NewWriterSize(NewStreamWriter(stream, t.log), 10*1024)
err = extract.WriteTarExclude(buf, mount.Source, false, excludes)
err := extract.WriteTarExclude(buf, mount.Source, false, excludes)
if err != nil {
return err
}
Expand Down

0 comments on commit 8c49c5e

Please sign in to comment.