Skip to content

Commit

Permalink
fix when there's no file
Browse files Browse the repository at this point in the history
  • Loading branch information
awmpietro committed Oct 16, 2023
1 parent 63d037f commit 5d71908
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ An error:
Returns nil if there is no error.
Returns the error encountered during the upload process otherwise.

##Configuration
## Configuration

Make sure to set up the GOOGLE_STORAGE_BUCKET_NAME environment variable in your environment. This should point to the path of the Google user account key you've previously created:

```yaml
Expand All @@ -55,5 +56,6 @@ export GOOGLE_STORAGE_BUCKET_NAME=path_to_your_google_account_key.json

Replace path_to_your_google_account_key.json with the actual path to your Google user account key file.

##Contributing
## Contributing

Feel free to open issues or PRs if you find any problems or have suggestions!
3 changes: 3 additions & 0 deletions gcpfileupload.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ func NewFileUploader(r *http.Request, formFile string, fileName string, bucketNa
func (fu *FileUploader) Upload() (bool, error) {
file, header, err := fu.Request.FormFile(fu.FormFile)
if err != nil {
if err == http.ErrMissingFile {
return false, nil
}
return false, err
}
defer file.Close()
Expand Down

0 comments on commit 5d71908

Please sign in to comment.