Skip to content

Commit

Permalink
return error when Put an empty file
Browse files Browse the repository at this point in the history
  • Loading branch information
wuxu92 committed Dec 11, 2023
1 parent 55cac93 commit 67117ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ vendor/
.idea/
example/example
.DS_Store
.vscode/
4 changes: 4 additions & 0 deletions storage/2020-08-04/file/files/range_put_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ func (c Client) PutFile(ctx context.Context, shareName, path, fileName string, f
return fmt.Errorf("error loading file info: %s", err)
}

if fileInfo.Size() == 0 {
return fmt.Errorf("file is empty which is not supported")
}

fileSize := fileInfo.Size()
chunkSize := 4 * 1024 * 1024 // 4MB
if chunkSize > int(fileSize) {
Expand Down

0 comments on commit 67117ec

Please sign in to comment.