Fix empty string comparison issues in the codebase (#16686)

Automatic Merge
Этот коммит содержится в:
Madhav Hugar
2021-01-25 11:15:17 +01:00
коммит произвёл GitHub
родитель 200a56fa5a
Коммит 94c24eea20
107 изменённых файлов: 368 добавлений и 368 удалений

Просмотреть файл

@@ -584,11 +584,11 @@ func (c *Client4) doApiRequestReader(method, url string, data io.Reader, etag st
return nil, NewAppError(url, "model.client.connecting.app_error", nil, err.Error(), http.StatusBadRequest)
}
if len(etag) > 0 {
if etag != "" {
rq.Header.Set(HEADER_ETAG_CLIENT, etag)
}
if len(c.AuthToken) > 0 {
if c.AuthToken != "" {
rq.Header.Set(HEADER_AUTH, c.AuthType+" "+c.AuthToken)
}
@@ -629,7 +629,7 @@ func (c *Client4) doUploadFile(url string, body io.Reader, contentType string, c
}
rq.Header.Set("Content-Type", contentType)
if len(c.AuthToken) > 0 {
if c.AuthToken != "" {
rq.Header.Set(HEADER_AUTH, c.AuthType+" "+c.AuthToken)
}
@@ -653,7 +653,7 @@ func (c *Client4) DoEmojiUploadFile(url string, data []byte, contentType string)
}
rq.Header.Set("Content-Type", contentType)
if len(c.AuthToken) > 0 {
if c.AuthToken != "" {
rq.Header.Set(HEADER_AUTH, c.AuthType+" "+c.AuthToken)
}
@@ -677,7 +677,7 @@ func (c *Client4) DoUploadImportTeam(url string, data []byte, contentType string
}
rq.Header.Set("Content-Type", contentType)
if len(c.AuthToken) > 0 {
if c.AuthToken != "" {
rq.Header.Set(HEADER_AUTH, c.AuthType+" "+c.AuthToken)
}
@@ -1490,7 +1490,7 @@ func (c *Client4) SetProfileImage(userId string, data []byte) (bool, *Response)
}
rq.Header.Set("Content-Type", writer.FormDataContentType())
if len(c.AuthToken) > 0 {
if c.AuthToken != "" {
rq.Header.Set(HEADER_AUTH, c.AuthType+" "+c.AuthToken)
}
@@ -1739,7 +1739,7 @@ func (c *Client4) SetBotIconImage(botUserId string, data []byte) (bool, *Respons
}
rq.Header.Set("Content-Type", writer.FormDataContentType())
if len(c.AuthToken) > 0 {
if c.AuthToken != "" {
rq.Header.Set(HEADER_AUTH, c.AuthType+" "+c.AuthToken)
}
@@ -2273,7 +2273,7 @@ func (c *Client4) SetTeamIcon(teamId string, data []byte) (bool, *Response) {
}
rq.Header.Set("Content-Type", writer.FormDataContentType())
if len(c.AuthToken) > 0 {
if c.AuthToken != "" {
rq.Header.Set(HEADER_AUTH, c.AuthType+" "+c.AuthToken)
}
@@ -3471,7 +3471,7 @@ func (c *Client4) UploadLicenseFile(data []byte) (bool, *Response) {
}
rq.Header.Set("Content-Type", writer.FormDataContentType())
if len(c.AuthToken) > 0 {
if c.AuthToken != "" {
rq.Header.Set(HEADER_AUTH, c.AuthType+" "+c.AuthToken)
}
@@ -3878,7 +3878,7 @@ func (c *Client4) DownloadComplianceReport(reportId string) ([]byte, *Response)
return nil, &Response{Error: NewAppError("DownloadComplianceReport", "model.client.connecting.app_error", nil, err.Error(), http.StatusBadRequest)}
}
if len(c.AuthToken) > 0 {
if c.AuthToken != "" {
rq.Header.Set(HEADER_AUTH, "BEARER "+c.AuthToken)
}
@@ -4248,7 +4248,7 @@ func (c *Client4) UploadBrandImage(data []byte) (bool, *Response) {
}
rq.Header.Set("Content-Type", writer.FormDataContentType())
if len(c.AuthToken) > 0 {
if c.AuthToken != "" {
rq.Header.Set(HEADER_AUTH, c.AuthType+" "+c.AuthToken)
}
@@ -4403,7 +4403,7 @@ func (c *Client4) GetOAuthAccessToken(data url.Values) (*AccessResponse, *Respon
}
rq.Header.Set("Content-Type", "application/x-www-form-urlencoded")
if len(c.AuthToken) > 0 {
if c.AuthToken != "" {
rq.Header.Set(HEADER_AUTH, c.AuthType+" "+c.AuthToken)
}
@@ -5042,7 +5042,7 @@ func (c *Client4) uploadPlugin(file io.Reader, force bool) (*Manifest, *Response
}
rq.Header.Set("Content-Type", writer.FormDataContentType())
if len(c.AuthToken) > 0 {
if c.AuthToken != "" {
rq.Header.Set(HEADER_AUTH, c.AuthType+" "+c.AuthToken)
}