summaryrefslogtreecommitdiffstats
path: root/api4/compliance.go
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2018-03-12 10:21:20 -0400
committerGitHub <noreply@github.com>2018-03-12 10:21:20 -0400
commit4e26594fcb03c378222d2316a004c291d48dd6c7 (patch)
tree76aa6d8a8255c141ee04997d31cde84a70f7f807 /api4/compliance.go
parent81acb1a14b404941dcd79c3088f09ee310896690 (diff)
downloadchat-4e26594fcb03c378222d2316a004c291d48dd6c7.tar.gz
chat-4e26594fcb03c378222d2316a004c291d48dd6c7.tar.bz2
chat-4e26594fcb03c378222d2316a004c291d48dd6c7.zip
Removed mssola/user_agent library (#8417)
* Removed mssola/user_agent library * Changed user agent tests to use t.Run
Diffstat (limited to 'api4/compliance.go')
-rw-r--r--api4/compliance.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/api4/compliance.go b/api4/compliance.go
index 71f0fa81d..4035afb77 100644
--- a/api4/compliance.go
+++ b/api4/compliance.go
@@ -7,8 +7,8 @@ import (
"net/http"
"strconv"
+ "github.com/avct/uasurfer"
"github.com/mattermost/mattermost-server/model"
- "github.com/mssola/user_agent"
)
func (api *API) InitCompliance() {
@@ -108,12 +108,11 @@ func downloadComplianceReport(c *Context, w http.ResponseWriter, r *http.Request
w.Header().Del("Content-Type") // Content-Type will be set automatically by the http writer
// attach extra headers to trigger a download on IE, Edge, and Safari
- ua := user_agent.New(r.UserAgent())
- bname, _ := ua.Browser()
+ ua := uasurfer.Parse(r.UserAgent())
w.Header().Set("Content-Disposition", "attachment;filename=\""+job.JobName()+".zip\"")
- if bname == "Edge" || bname == "Internet Explorer" || bname == "Safari" {
+ if ua.Browser.Name == uasurfer.BrowserIE || ua.Browser.Name == uasurfer.BrowserSafari {
// trim off anything before the final / so we just get the file's name
w.Header().Set("Content-Type", "application/octet-stream")
}