use 'ContentType' rather than 'EncodeBase64' in tools.json
This commit is contained in:
parent
4ceca4f3d3
commit
1e3b329150
6
main.go
6
main.go
@ -30,7 +30,7 @@ type Tool struct {
|
|||||||
Cmd string
|
Cmd string
|
||||||
Args []string
|
Args []string
|
||||||
NeedsFile bool
|
NeedsFile bool
|
||||||
EncodeBase64 bool
|
ContentType string
|
||||||
Suffix string
|
Suffix string
|
||||||
Description string
|
Description string
|
||||||
Documentation map[string]string
|
Documentation map[string]string
|
||||||
@ -74,8 +74,8 @@ func (t *Tool) execute(in io.Reader, w http.ResponseWriter) {
|
|||||||
cmd.Stdout = buf
|
cmd.Stdout = buf
|
||||||
|
|
||||||
if e := cmd.Run(); e == nil {
|
if e := cmd.Run(); e == nil {
|
||||||
if t.EncodeBase64 {
|
if t.ContentType != "" {
|
||||||
w.Header().Add("Content-Type", "img/png")
|
w.Header().Add("Content-Type", t.ContentType)
|
||||||
io.Copy(base64.NewEncoder(base64.StdEncoding, w), buf)
|
io.Copy(base64.NewEncoder(base64.StdEncoding, w), buf)
|
||||||
} else {
|
} else {
|
||||||
io.Copy(w, buf)
|
io.Copy(w, buf)
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
"Args": ["+O-", "-D", "+A0.9", "+R3"],
|
"Args": ["+O-", "-D", "+A0.9", "+R3"],
|
||||||
"Suffix": ".pov",
|
"Suffix": ".pov",
|
||||||
"NeedsFile": true,
|
"NeedsFile": true,
|
||||||
"EncodeBase64": true,
|
"ContentType": "img/png",
|
||||||
"Description": "Povray, raytracer",
|
"Description": "Povray, raytracer",
|
||||||
"BgColor": "Orange",
|
"BgColor": "Orange",
|
||||||
"Documentation": {
|
"Documentation": {
|
||||||
|
Loading…
Reference in New Issue
Block a user