Skip to content

Commit 6e576dd

Browse files
authored
Merge pull request #20 from parca-dev/empty-upload-validation
Ensure that upload is not going to be empty
2 parents 879cd57 + 613b39e commit 6e576dd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/parca-debuginfo/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ func run(kongCtx *kong.Context, flags flags) error {
163163

164164
buf.SeekStart()
165165
upload.size = int64(buf.Len())
166+
167+
if upload.size == 0 {
168+
return fmt.Errorf("extracted debug information from %q is empty, but must not be empty", upload.path)
169+
}
166170
}
167171
} else {
168172
for _, path := range flags.Upload.Paths {
@@ -192,6 +196,10 @@ func run(kongCtx *kong.Context, flags flags) error {
192196
return fmt.Errorf("stat file: %w", err)
193197
}
194198

199+
if fi.Size() == 0 {
200+
return fmt.Errorf("file %q is empty, but must not be empty", path)
201+
}
202+
195203
uploads = append(uploads, &uploadInfo{
196204
buildID: buildID,
197205
path: path,

0 commit comments

Comments
 (0)