Skip to content

Commit

Permalink
Merge pull request #20 from parca-dev/empty-upload-validation
Browse files Browse the repository at this point in the history
Ensure that upload is not going to be empty
  • Loading branch information
brancz authored Dec 15, 2023
2 parents 879cd57 + 613b39e commit 6e576dd
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 6e576dd

Please sign in to comment.