Skip to content
Snippets Groups Projects
Commit 18baef41 authored by Travis Ralston's avatar Travis Ralston
Browse files

Exclude charset from content type matches

parent d64ac70b
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ import (
"mime"
"net/http"
"strconv"
"strings"
"time"
"github.com/prometheus/client_golang/prometheus"
......@@ -97,6 +98,9 @@ func downloadFileContent(urlStr string, log *logrus.Entry) (*PreviewImage, error
}
contentType := resp.Header.Get("Content-Type")
if strings.Contains(contentType, ";") {
contentType = strings.Split(contentType, ";")[0]
}
if len(config.Get().UrlPreviews.FilePreviewTypes) > 0 {
for _, allowedType := range config.Get().UrlPreviews.FilePreviewTypes {
if !glob.Glob(allowedType, contentType) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment