Skip to content

Commit

Permalink
fix: error causes panic on upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiresviana committed Mar 23, 2021
1 parent 7dd5b34 commit e1a6f59
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions http/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ func resourcePostHandler(fileCache FileCache) handleFunc {
}

err = d.RunHook(func() error {
info, _ := writeFile(d.user.Fs, r.URL.Path, r.Body)
info, writeErr := writeFile(d.user.Fs, r.URL.Path, r.Body)
if writeErr != nil {
return writeErr
}

etag := fmt.Sprintf(`"%x%x"`, info.ModTime().UnixNano(), info.Size())
w.Header().Set("ETag", etag)
Expand Down Expand Up @@ -155,7 +158,10 @@ var resourcePutHandler = withUser(func(w http.ResponseWriter, r *http.Request, d
}

err := d.RunHook(func() error {
info, _ := writeFile(d.user.Fs, r.URL.Path, r.Body)
info, writeErr := writeFile(d.user.Fs, r.URL.Path, r.Body)
if writeErr != nil {
return writeErr
}

etag := fmt.Sprintf(`"%x%x"`, info.ModTime().UnixNano(), info.Size())
w.Header().Set("ETag", etag)
Expand Down

0 comments on commit e1a6f59

Please sign in to comment.