Skip to content

Commit e1a6f59

Browse files
committed
fix: error causes panic on upload
1 parent 7dd5b34 commit e1a6f59

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

http/resource.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ func resourcePostHandler(fileCache FileCache) handleFunc {
125125
}
126126

127127
err = d.RunHook(func() error {
128-
info, _ := writeFile(d.user.Fs, r.URL.Path, r.Body)
128+
info, writeErr := writeFile(d.user.Fs, r.URL.Path, r.Body)
129+
if writeErr != nil {
130+
return writeErr
131+
}
129132

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

157160
err := d.RunHook(func() error {
158-
info, _ := writeFile(d.user.Fs, r.URL.Path, r.Body)
161+
info, writeErr := writeFile(d.user.Fs, r.URL.Path, r.Body)
162+
if writeErr != nil {
163+
return writeErr
164+
}
159165

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

0 commit comments

Comments
 (0)