summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2022-05-28 18:10:14 +0300
committerGitHub <noreply@github.com>2022-05-28 18:10:14 +0300
commit65e0688a5c9dacad50e71024b7529fdf0e3c2e9c (patch)
treeab10b986df4dd03bd2d1a8230e4b6f8559966e99 /modules
parent410df1fbd47aa17488f7167d868c85e84c8217ef (diff)
downloadgitea-65e0688a5c9dacad50e71024b7529fdf0e3c2e9c.tar.gz
gitea-65e0688a5c9dacad50e71024b7529fdf0e3c2e9c.zip
Fix raw endpoint PDF file headers (#19825)
Diffstat (limited to 'modules')
-rw-r--r--modules/typesniffer/typesniffer.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/typesniffer/typesniffer.go b/modules/typesniffer/typesniffer.go
index e4bed6595a..b6a6646d50 100644
--- a/modules/typesniffer/typesniffer.go
+++ b/modules/typesniffer/typesniffer.go
@@ -17,8 +17,12 @@ import (
// Use at most this many bytes to determine Content Type.
const sniffLen = 1024
-// SvgMimeType MIME type of SVG images.
-const SvgMimeType = "image/svg+xml"
+const (
+ // SvgMimeType MIME type of SVG images.
+ SvgMimeType = "image/svg+xml"
+ // ApplicationOctetStream MIME type of binary files.
+ ApplicationOctetStream = "application/octet-stream"
+)
var (
svgTagRegex = regexp.MustCompile(`(?si)\A\s*(?:(<!--.*?-->|<!DOCTYPE\s+svg([\s:]+.*?>|>))\s*)*<svg[\s>\/]`)