diff options
author | JoramWilander <jwawilander@gmail.com> | 2015-07-21 19:21:05 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2015-07-21 19:23:00 -0400 |
commit | b821d23ed71c89b14aa294debcf390057de27b37 (patch) | |
tree | 10b0da76d799d952f32d058550fa5cfb5fda7422 /api/file.go | |
parent | 39abf24708870cec71a84c01063e647b859b2b67 (diff) | |
download | chat-b821d23ed71c89b14aa294debcf390057de27b37.tar.gz chat-b821d23ed71c89b14aa294debcf390057de27b37.tar.bz2 chat-b821d23ed71c89b14aa294debcf390057de27b37.zip |
fixed unit tests to work with team domain changes and update partial url regex for files
Diffstat (limited to 'api/file.go')
-rw-r--r-- | api/file.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/api/file.go b/api/file.go index 1dd179422..82cee9d1e 100644 --- a/api/file.go +++ b/api/file.go @@ -297,15 +297,14 @@ func getPublicLink(c *Context, w http.ResponseWriter, r *http.Request) { } matches := model.PartialUrlRegex.FindAllStringSubmatch(filename, -1) - if len(matches) == 0 || len(matches[0]) < 5 { + if len(matches) == 0 || len(matches[0]) < 4 { c.SetInvalidParam("getPublicLink", "filename") return } - getType := matches[0][1] - channelId := matches[0][2] - userId := matches[0][3] - filename = matches[0][4] + channelId := matches[0][1] + userId := matches[0][2] + filename = matches[0][3] cchan := Srv.Store.Channel().CheckPermissionsTo(c.Session.TeamId, channelId, c.Session.UserId) @@ -316,7 +315,7 @@ func getPublicLink(c *Context, w http.ResponseWriter, r *http.Request) { data := model.MapToJson(newProps) hash := model.HashPassword(fmt.Sprintf("%v:%v", data, utils.Cfg.ServiceSettings.PublicLinkSalt)) - url := fmt.Sprintf("%s/api/v1/files/%s/%s/%s/%s?d=%s&h=%s&t=%s", c.GetSiteURL(), getType, channelId, userId, filename, url.QueryEscape(data), url.QueryEscape(hash), c.Session.TeamId) + url := fmt.Sprintf("%s/api/v1/files/get/%s/%s/%s?d=%s&h=%s&t=%s", c.GetSiteURL(), channelId, userId, filename, url.QueryEscape(data), url.QueryEscape(hash), c.Session.TeamId) if !c.HasPermissionsToChannel(cchan, "getPublicLink") { return |