summaryrefslogtreecommitdiffstats
path: root/model/client4.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-07-12 14:13:25 +0100
committerSaturnino Abril <saturnino.abril@gmail.com>2017-07-12 22:13:25 +0900
commit2bf64b54c236945727a2d93afb57b1665d1daa7a (patch)
treea7b0b3c1114faf5e398b6cb06fd9e61fb818f7b9 /model/client4.go
parente975b84a12b8e3f547f4d811155d076a5a4fdcf9 (diff)
downloadchat-2bf64b54c236945727a2d93afb57b1665d1daa7a.tar.gz
chat-2bf64b54c236945727a2d93afb57b1665d1daa7a.tar.bz2
chat-2bf64b54c236945727a2d93afb57b1665d1daa7a.zip
PLT-7025: Fix Slack Import API. (#6905)
Diffstat (limited to 'model/client4.go')
-rw-r--r--model/client4.go8
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)