[archiver] Add mime types aliases for auto detection.

This commit is contained in:
Ciprian Dorin Craciun 2021-12-20 22:20:43 +02:00
parent c8bf6ee056
commit d6e131e60c
4 changed files with 46 additions and 21 deletions

Binary file not shown.

View file

@ -1,41 +1,55 @@
+1,5 +6,14
s schema
2021a kawipiko-2021b
+3,3 +3,16
f:/ f:/
1:2 m0000001d0000002
+3,117 +8,48
m:1 m0000001
Cache-Control: public, immutable, max-age=3600 h0000017H0000001h000001cH0000003h0000025H000000d
Content-Encoding: identity
Content-Type: text/plain; charset=utf-8
+8,13
+3,13 d0000002
c:2
Hello world! Hello world!
+4,3 +3,16
l:/
m0000003d0000004
+8,48
m0000003
h0000017H0000001h000001cH0000003h0000025H0000012
+8,82
d0000004
{"entries":[{"name":"index.txt","type":"file","size":13}],"indices":["index.txt"]}
+4,16
f:/* f:/*
1:2 m0000001d0000002
+8,3 +8,16
f:/index f:/index
1:2 m0000001d0000002
+12,3 +12,16
f:/index.txt f:/index.txt
1:2 m0000001d0000002
+2,23 +8,23
fi F0000001
/ /
/* /*
/index /index
/index.txt /index.txt
+8,2
L0000001
/

View file

@ -541,6 +541,11 @@ func prepareDataContent (_context *context, _pathResolved string, _pathInArchive
} }
if (_dataType == "") { if (_dataType == "") {
_dataType = http.DetectContentType (_dataContent) _dataType = http.DetectContentType (_dataContent)
if _dataType != "" {
if _dataType_0, _ := MimeTypesAliases[_dataType]; _dataType_0 != "" {
_dataType = _dataType_0
}
}
} }
if _dataType == "" { if _dataType == "" {
_dataType = MimeTypeRaw _dataType = MimeTypeRaw

View file

@ -193,3 +193,9 @@ var MimeTypes = []string {
} }
var MimeTypesAliases = map[string]string {
"text/xml; charset=utf-8" : MimeTypeXml,
}