Skip to content

Commit

Permalink
Ensure that upload is not going to be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
brancz committed Dec 15, 2023
1 parent 879cd57 commit 613b39e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/parca-debuginfo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ func run(kongCtx *kong.Context, flags flags) error {

buf.SeekStart()
upload.size = int64(buf.Len())

if upload.size == 0 {
return fmt.Errorf("extracted debug information from %q is empty, but must not be empty", upload.path)
}
}
} else {
for _, path := range flags.Upload.Paths {
Expand Down Expand Up @@ -192,6 +196,10 @@ func run(kongCtx *kong.Context, flags flags) error {
return fmt.Errorf("stat file: %w", err)
}

if fi.Size() == 0 {
return fmt.Errorf("file %q is empty, but must not be empty", path)
}

uploads = append(uploads, &uploadInfo{
buildID: buildID,
path: path,
Expand Down

0 comments on commit 613b39e

Please sign in to comment.