aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÖzgür Kesim <oec@codeblau.de>2018-11-26 07:54:18 +0100
committerÖzgür Kesim <oec@codeblau.de>2018-11-26 07:54:18 +0100
commit1e3b329150d6c259ba058f8d8f2e1b3fd4bb525d (patch)
tree1381b5924bc0d4603f288ed8f58829ea6d998c2d
parent4ceca4f3d3ce3b24429f0b6c6aec2a5ada432fff (diff)
use 'ContentType' rather than 'EncodeBase64' in tools.json
-rw-r--r--main.go6
-rw-r--r--tools.json2
2 files changed, 4 insertions, 4 deletions
diff --git a/main.go b/main.go
index 24cb4a7..07e15b1 100644
--- a/main.go
+++ b/main.go
@@ -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)
diff --git a/tools.json b/tools.json
index 9735acc..f19fa5d 100644
--- a/tools.json
+++ b/tools.json
@@ -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": {