Replace ioutil.Discard with io.Discard (#20707)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c00609ab8e
Коммит
eba08cbb11
@@ -381,7 +381,7 @@ func (th *TestHelper) TearDown() {
|
||||
|
||||
func closeBody(r *http.Response) {
|
||||
if r.Body != nil {
|
||||
_, _ = io.Copy(ioutil.Discard, r.Body)
|
||||
_, _ = io.Copy(io.Discard, r.Body)
|
||||
_ = r.Body.Close()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ package api4
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v6/audit"
|
||||
@@ -33,7 +32,7 @@ func getBrandImage(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func uploadBrandImage(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
defer io.Copy(ioutil.Discard, r.Body)
|
||||
defer io.Copy(io.Discard, r.Body)
|
||||
|
||||
if r.ContentLength > *c.App.Config().FileSettings.MaxFileSize {
|
||||
c.Err = model.NewAppError("uploadBrandImage", "api.admin.upload_brand_image.too_large.app_error", nil, "", http.StatusRequestEntityTooLarge)
|
||||
|
||||
@@ -6,7 +6,6 @@ package api4
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v6/app"
|
||||
@@ -32,7 +31,7 @@ func (api *API) InitEmoji() {
|
||||
}
|
||||
|
||||
func createEmoji(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
defer io.Copy(ioutil.Discard, r.Body)
|
||||
defer io.Copy(io.Discard, r.Body)
|
||||
|
||||
if !*c.App.Config().ServiceSettings.EnableCustomEmoji {
|
||||
c.Err = model.NewAppError("createEmoji", "api.emoji.disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
|
||||
@@ -6,7 +6,6 @@ package api4
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@@ -222,7 +221,7 @@ func uploadRemoteData(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func remoteSetProfileImage(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
defer io.Copy(ioutil.Discard, r.Body)
|
||||
defer io.Copy(io.Discard, r.Body)
|
||||
|
||||
c.RequireUserId()
|
||||
if c.Err != nil {
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"path"
|
||||
"reflect"
|
||||
@@ -527,7 +526,7 @@ func getRedirectLocation(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
io.Copy(ioutil.Discard, res.Body)
|
||||
io.Copy(io.Discard, res.Body)
|
||||
res.Body.Close()
|
||||
}()
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strconv"
|
||||
@@ -1610,7 +1609,7 @@ func getTeamIcon(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func setTeamIcon(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
defer io.Copy(ioutil.Discard, r.Body)
|
||||
defer io.Copy(io.Discard, r.Body)
|
||||
|
||||
c.RequireTeamId()
|
||||
if c.Err != nil {
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -419,7 +418,7 @@ func getProfileImage(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func setProfileImage(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
defer io.Copy(ioutil.Discard, r.Body)
|
||||
defer io.Copy(io.Discard, r.Body)
|
||||
|
||||
c.RequireUserId()
|
||||
if c.Err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user