diff --git a/internal/util/fs.go b/internal/util/fs.go index 14e6403..6c04f8f 100644 --- a/internal/util/fs.go +++ b/internal/util/fs.go @@ -10,6 +10,10 @@ func MakeLocal(filename, username string, buf []byte) error { return fmt.Errorf("file %s already exists: %w", filename, err) } + if len(buf) == 0 { + return fmt.Errorf("will not save empty file: %s to FS", filename) + } + f, err := os.Create("/tmp/tmpfile-" + filename + "-" + username) //nolint: gosec // this is set to nolint because I am doing everything os.CreateTemp does but here since I don't like some of the limitations if err != nil {