use 'ContentType' rather than 'EncodeBase64' in tools.json

This commit is contained in:
Özgür Kesim 2018-11-26 07:54:18 +01:00
parent 4ceca4f3d3
commit 1e3b329150
2 changed files with 4 additions and 4 deletions

View File

@ -30,7 +30,7 @@ type Tool struct {
Cmd string
Args []string
NeedsFile bool
EncodeBase64 bool
ContentType string
Suffix string
Description string
Documentation map[string]string
@ -74,8 +74,8 @@ func (t *Tool) execute(in io.Reader, w http.ResponseWriter) {
cmd.Stdout = buf
if e := cmd.Run(); e == nil {
if t.EncodeBase64 {
w.Header().Add("Content-Type", "img/png")
if t.ContentType != "" {
w.Header().Add("Content-Type", t.ContentType)
io.Copy(base64.NewEncoder(base64.StdEncoding, w), buf)
} else {
io.Copy(w, buf)

View File

@ -32,7 +32,7 @@
"Args": ["+O-", "-D", "+A0.9", "+R3"],
"Suffix": ".pov",
"NeedsFile": true,
"EncodeBase64": true,
"ContentType": "img/png",
"Description": "Povray, raytracer",
"BgColor": "Orange",
"Documentation": {