mirror of
https://git.freecumextremist.com/grumbulon/pomme.git
synced 2024-11-22 05:13:47 +00:00
return error if file being saved to /tmp is empty
This commit is contained in:
parent
ae488eb7d2
commit
653670e6fa
1 changed files with 4 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue