Workaround for IPTVX content-type bug

This commit is contained in:
marmei
2019-12-28 12:28:33 +01:00
parent 91b80bc8bb
commit 1cefbf022d

View File

@@ -206,7 +206,7 @@ func Auto(w http.ResponseWriter, r *http.Request) {
// xTeVe : Web Server /xmltv/ und /m3u/
func xTeVe(w http.ResponseWriter, r *http.Request) {
var requestType, groupTitle, file, content string
var requestType, groupTitle, file, content, contentType string
var err error
var path = strings.TrimPrefix(r.URL.Path, "/")
var groups = []string{}
@@ -226,8 +226,6 @@ func xTeVe(w http.ResponseWriter, r *http.Request) {
return
}
w.Header().Set("Content-Type", http.DetectContentType([]byte(content)))
}
// M3U Datei
@@ -261,6 +259,13 @@ func xTeVe(w http.ResponseWriter, r *http.Request) {
return
}
contentType = http.DetectContentType([]byte(content))
if strings.Contains(strings.ToLower(contentType), "xml") {
contentType = "application/xml; charset=utf-8"
}
w.Header().Set("Content-Type", contentType)
if err == nil {
w.Write([]byte(content))
}