Skip to content

Commit

Permalink
fix(server/webdav) avoid variable 'stream' collides with imported pac…
Browse files Browse the repository at this point in the history
…kage name
  • Loading branch information
potoo0 committed Apr 20, 2024
1 parent 16cbffd commit d72112d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server/webdav/webdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,21 +331,21 @@ func (h *Handler) handlePut(w http.ResponseWriter, r *http.Request) (status int,
Modified: h.getModTime(r),
Ctime: h.getCreateTime(r),
}
stream := &stream.FileStream{
fsStream := &stream.FileStream{
Obj: &obj,
Reader: r.Body,
Mimetype: r.Header.Get("Content-Type"),
}
if stream.Mimetype == "" {
stream.Mimetype = utils.GetMimeType(reqPath)
if fsStream.Mimetype == "" {
fsStream.Mimetype = utils.GetMimeType(reqPath)
}
err = fs.PutDirectly(ctx, path.Dir(reqPath), stream)
err = fs.PutDirectly(ctx, path.Dir(reqPath), fsStream)
if errs.IsNotFoundError(err) {
return http.StatusNotFound, err
}

_ = r.Body.Close()
_ = stream.Close()
_ = fsStream.Close()
// TODO(rost): Returning 405 Method Not Allowed might not be appropriate.
if err != nil {
return http.StatusMethodNotAllowed, err
Expand Down

0 comments on commit d72112d

Please sign in to comment.