diff options
Diffstat (limited to 'model')
-rw-r--r-- | model/client4.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/model/client4.go b/model/client4.go index b10ced27f..9ecdf9a62 100644 --- a/model/client4.go +++ b/model/client4.go @@ -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) |