From d1a3278ee74994e9aa609e9e711c616bba677d5d Mon Sep 17 00:00:00 2001 From: Andrew Bonventre Date: Wed, 15 May 2019 19:37:55 -0400 Subject: [PATCH] godoc/util: serve SVG files raw When a godoc Presentation is serving a file, it will sniff its contents to determine if it contains "human-readable" text. If it does, then it serves the contents of the file with surrounding HTML. SVG files should not be served with any additional HTML even though their contents are not a binary format (just like CSS or JS files). Updates golang/go#9936 Change-Id: Id3dd3b6cda4f103b08f6e924923426a86bd46ec8 Reviewed-on: https://go-review.googlesource.com/c/tools/+/177498 Reviewed-by: Brad Fitzpatrick --- godoc/util/util.go | 1 + 1 file changed, 1 insertion(+) diff --git a/godoc/util/util.go b/godoc/util/util.go index feedb7688a..c08ca785fe 100644 --- a/godoc/util/util.go +++ b/godoc/util/util.go @@ -59,6 +59,7 @@ func IsText(s []byte) bool { var textExt = map[string]bool{ ".css": false, // must be served raw ".js": false, // must be served raw + ".svg": false, // must be served raw } // IsTextFile reports whether the file has a known extension indicating