mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
PLT-7025: Fix Slack Import API. (#6905)
This commit is contained in:
committed by
Saturnino Abril
parent
e975b84a12
commit
2bf64b54c2
@@ -352,7 +352,7 @@ func (c *Client4) DoEmojiUploadFile(url string, data []byte, contentType string)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client4) DoUploadImportTeam(url string, data []byte, contentType string) ([]byte, *Response) {
|
||||
func (c *Client4) DoUploadImportTeam(url string, data []byte, contentType string) (map[string]string, *Response) {
|
||||
rq, _ := http.NewRequest("POST", c.ApiUrl+url, bytes.NewReader(data))
|
||||
rq.Header.Set("Content-Type", contentType)
|
||||
rq.Close = true
|
||||
@@ -365,11 +365,9 @@ func (c *Client4) DoUploadImportTeam(url string, data []byte, contentType string
|
||||
return nil, &Response{Error: NewAppError(url, "model.client.connecting.app_error", nil, err.Error(), 0)}
|
||||
} else if rp.StatusCode >= 300 {
|
||||
return nil, &Response{StatusCode: rp.StatusCode, Error: AppErrorFromJson(rp.Body)}
|
||||
} else if data, err := ioutil.ReadAll(rp.Body); err != nil {
|
||||
return nil, &Response{StatusCode: rp.StatusCode, Error: NewAppError("UploadImportTeam", "model.client.read_file.app_error", nil, err.Error(), rp.StatusCode)}
|
||||
} else {
|
||||
defer closeBody(rp)
|
||||
return data, BuildResponse(rp)
|
||||
return MapFromJson(rp.Body), BuildResponse(rp)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1210,7 +1208,7 @@ func (c *Client4) GetTeamUnread(teamId, userId string) (*TeamUnread, *Response)
|
||||
}
|
||||
|
||||
// ImportTeam will import an exported team from other app into a existing team.
|
||||
func (c *Client4) ImportTeam(data []byte, filesize int, importFrom, filename, teamId string) ([]byte, *Response) {
|
||||
func (c *Client4) ImportTeam(data []byte, filesize int, importFrom, filename, teamId string) (map[string]string, *Response) {
|
||||
body := &bytes.Buffer{}
|
||||
writer := multipart.NewWriter(body)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user