From 3459e20be1ccf864288ba8d5be7ee96bb29da42f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Fri, 14 Jun 2019 12:25:10 +0200 Subject: [PATCH] base64 encoding and image/png fixed in Header --- index.html | 2 +- main.go | 1 + tools.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 3739c6f..28a02fc 100644 --- a/index.html +++ b/index.html @@ -161,7 +161,7 @@ function run() { req.onreadystatechange = function() { switch (req.status) { case 200: - if (req.getResponseHeader("Content-Type") === "img/png") { + if (req.getResponseHeader("Content-Type") === "image/png") { output.innerHTML = ''; } else { output.innerHTML = req.responseText; diff --git a/main.go b/main.go index d508957..0665c09 100644 --- a/main.go +++ b/main.go @@ -76,6 +76,7 @@ func (t *Tool) execute(in io.Reader, w http.ResponseWriter) { if e := cmd.Run(); e == nil { if t.ContentType != "" { w.Header().Add("Content-Type", t.ContentType) + w.Header().Set("Content-Transfer-Encoding", "base64") io.Copy(base64.NewEncoder(base64.StdEncoding, w), buf) } else { w.Header().Add("Content-Type", "image/svg+xml") diff --git a/tools.json b/tools.json index f19fa5d..1158b14 100644 --- a/tools.json +++ b/tools.json @@ -32,7 +32,7 @@ "Args": ["+O-", "-D", "+A0.9", "+R3"], "Suffix": ".pov", "NeedsFile": true, - "ContentType": "img/png", + "ContentType": "image/png", "Description": "Povray, raytracer", "BgColor": "Orange", "Documentation": {