PLT-2600/PLT-2770 Added Get Public Link modal and added new API for public file links (#2892)
* Switched public file links to use a GetLinkModal * Separated getFile and the new getPublicFile api calls
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
696ffb4745
Коммит
d2ddf40f56
@@ -993,12 +993,19 @@ func (c *Client) GetFileInfo(url string) (*Result, *AppError) {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) GetPublicLink(data map[string]string) (*Result, *AppError) {
|
||||
if r, err := c.DoApiPost(c.GetTeamRoute()+"/files/get_public_link", MapToJson(data)); err != nil {
|
||||
func (c *Client) GetPublicLink(filename string) (*Result, *AppError) {
|
||||
if r, err := c.DoApiPost(c.GetTeamRoute()+"/files/get_public_link", MapToJson(map[string]string{"filename": filename})); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
var link string
|
||||
if body, err := ioutil.ReadAll(r.Body); err == nil {
|
||||
link = string(body)
|
||||
} else {
|
||||
// all the other Client methods return an empty string on invalid json, so we can too
|
||||
}
|
||||
|
||||
return &Result{r.Header.Get(HEADER_REQUEST_ID),
|
||||
r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil
|
||||
r.Header.Get(HEADER_ETAG_SERVER), link}, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user