diff --git a/utility/embed-static.sh b/utility/embed-static.sh index ec91dc9e3..1e14602f2 100755 --- a/utility/embed-static.sh +++ b/utility/embed-static.sh @@ -5,34 +5,21 @@ package blob var files = map [string] map [string] []byte { EOF -type_file=`tempfile` -cat < $type_file -var types = map [string] map [string] string { -EOF - CDIR=`pwd` for dir in $@ do cd "$dir" echo -e "\t\"`basename $dir`\": {" - echo -e "\t\"`basename $dir`\": {" >> $type_file find -type f | while read file do - mime=`mimetype -b "$file"` name=`echo "$file"|sed 's|\.\/||'` - echo -e "\t\t\"$name\": \"$mime\"," >> $type_file - echo -e "\t\t\"$name\": {" gzip -9 -c "$file" | xxd -p |sed 's/\(..\)/0x\1, /g' echo -e "\t\t}," echo done - echo -e "\t}," >> $type_file echo -e "\t}," cd $CDIR done echo '}' -cat $type_file -echo '}' -rm $type_file diff --git a/web/blob/blob.go b/web/blob/blob.go index 27907ad2d..5d9e4c135 100644 --- a/web/blob/blob.go +++ b/web/blob/blob.go @@ -10,7 +10,7 @@ import ( const ( TemplateFiles = "templates" - StaticFiles = "static" + StaticFiles = "static" ) func GetFile(bucket string, name string) ([]byte, error) { @@ -43,6 +43,6 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotFound) return } - w.Header().Set("Content-Type", types[StaticFiles][name]) + w.Header().Set("Content-Type", http.DetectContentType(file)) w.Write(file) }