shithub: hugo

Download patch

ref: 689f647baf96af078186f0cdc45199f7d0995d22
parent: 46cafdbaca13866f32db04c0cc28374e30ec5914
author: Nicolas Martignoni <[email protected]>
date: Wed Oct 16 11:10:32 EDT 2019

media: Add common video media types

- See https://discourse.gohugo.io/t/resources-bytype-for-video-files/21285

--- a/media/mediaType.go
+++ b/media/mediaType.go
@@ -145,6 +145,14 @@
 	TIFFType = Type{MainType: "image", SubType: "tiff", Suffixes: []string{"tif", "tiff"}, Delimiter: defaultDelimiter}
 	BMPType  = Type{MainType: "image", SubType: "bmp", Suffixes: []string{"bmp"}, Delimiter: defaultDelimiter}
 
+	// Common video types
+	AVIType  = Type{MainType: "video", SubType: "x-msvideo", Suffixes: []string{"avi"}, Delimiter: defaultDelimiter}
+	MPEGType = Type{MainType: "video", SubType: "mpeg", Suffixes: []string{"mpg", "mpeg"}, Delimiter: defaultDelimiter}
+	MP4Type  = Type{MainType: "video", SubType: "mp4", Suffixes: []string{"mp4"}, Delimiter: defaultDelimiter}
+	OGGType  = Type{MainType: "video", SubType: "ogg", Suffixes: []string{"ogv"}, Delimiter: defaultDelimiter}
+	WEBMType = Type{MainType: "video", SubType: "webm", Suffixes: []string{"webm"}, Delimiter: defaultDelimiter}
+	GPPType  = Type{MainType: "video", SubType: "3gpp", Suffixes: []string{"3gpp", "3gp"}, Delimiter: defaultDelimiter}
+
 	OctetType = Type{MainType: "application", SubType: "octet-stream"}
 )
 
@@ -167,6 +175,12 @@
 	TOMLType,
 	PNGType,
 	JPGType,
+	AVIType,
+	MPEGType,
+	MP4Type,
+	OGGType,
+	WEBMType,
+	GPPType,
 }
 
 func init() {
--- a/media/mediaType_test.go
+++ b/media/mediaType_test.go
@@ -58,7 +58,7 @@
 
 	}
 
-	c.Assert(len(DefaultTypes), qt.Equals, 17)
+	c.Assert(len(DefaultTypes), qt.Equals, 23)
 
 }