Some cleanup

This commit is contained in:
andreimarcu 2015-09-24 08:30:16 -04:00
parent 52b7e594f3
commit d130cfe8e1
3 changed files with 9 additions and 11 deletions

View File

@ -77,16 +77,14 @@ func processUpload(upReq UploadRequest) (upload Upload, err error) {
upload.Filename = strings.Join([]string{barename, extension}, ".")
dst, ferr := os.Create(path.Join("files/", upload.Filename))
defer dst.Close()
if ferr != nil {
err = ferr
dst, err := os.Create(path.Join("files/", upload.Filename))
if err != nil {
return
}
defer dst.Close()
bytes, cerr := io.Copy(dst, upReq.src)
if cerr != nil {
err = cerr
bytes, err := io.Copy(dst, upReq.src)
if err != nil {
return
} else if bytes == 0 {
err = errors.New("Empty file")