mirror of
https://github.com/documize/community.git
synced 2025-07-22 06:39:43 +02:00
initial commit
This commit is contained in:
commit
18933c6767
1841 changed files with 810642 additions and 0 deletions
20
vendor/github.com/mytrile/mime-ext/LICENSE
generated
vendored
Normal file
20
vendor/github.com/mytrile/mime-ext/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Dimitar Kostov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
26
vendor/github.com/mytrile/mime-ext/README.md
generated
vendored
Normal file
26
vendor/github.com/mytrile/mime-ext/README.md
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
# mime-ext
|
||||
|
||||
This is a library that adds a huge number of mime types for using with [mime.TypeByExtension()](http://golang.org/pkg/mime/#TypeByExtension)
|
||||
|
||||
## Usage
|
||||
|
||||
``` go
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"mime"
|
||||
_ "github.com/mytrile/mime-ex"
|
||||
)
|
||||
|
||||
func main() {
|
||||
gz_type := mime.TypeByExtension(".gz") //=> "application/gzip"
|
||||
}
|
||||
```
|
||||
|
||||
## Meta
|
||||
|
||||
* Author : Dimitar Kostov
|
||||
* Email : mitko.kostov@gmail.com
|
||||
* Website : [http://mytrile.github.com](http://mytrile.github.com)
|
||||
* Twitter : [http://twitter.com/mytrile](http://twitter.com/mytrile)
|
1141
vendor/github.com/mytrile/mime-ext/all-mime-types.go
generated
vendored
Normal file
1141
vendor/github.com/mytrile/mime-ext/all-mime-types.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
12
vendor/github.com/mytrile/mime-ext/mime-ext.go
generated
vendored
Normal file
12
vendor/github.com/mytrile/mime-ext/mime-ext.go
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
package mimeext
|
||||
|
||||
import "mime"
|
||||
|
||||
func init() {
|
||||
for key, value := range allMimeTypes {
|
||||
err := mime.AddExtensionType(key, value)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
23
vendor/github.com/mytrile/mime-ext/mime-ext_test.go
generated
vendored
Normal file
23
vendor/github.com/mytrile/mime-ext/mime-ext_test.go
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
package mimeext
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"mime"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_AddingMimeTypes(t *testing.T) {
|
||||
for key, _ := range allMimeTypes {
|
||||
if strings.HasPrefix(allMimeTypes[key], "text/") {
|
||||
if mime.TypeByExtension(key) != fmt.Sprintf("%s; charset=utf-8", allMimeTypes[key]) {
|
||||
t.Errorf("Missing mime type: %s", allMimeTypes[key])
|
||||
}
|
||||
} else {
|
||||
if mime.TypeByExtension(key) != allMimeTypes[key] {
|
||||
t.Errorf("Missing mime type: %s", allMimeTypes[key])
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue