Playground output escape

This commit is contained in:
Liang Ding 2015-07-31 11:39:08 +08:00
parent 95cdebcc09
commit 38e16a4658
1 changed files with 1 additions and 6 deletions

View File

@ -20,7 +20,6 @@ import (
"math/rand"
"net/http"
"os/exec"
"strings"
"time"
"github.com/b3log/wide/conf"
@ -163,8 +162,6 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
}
oneRuneStr := string(r)
oneRuneStr = strings.Replace(oneRuneStr, "<", "&lt;", -1)
oneRuneStr = strings.Replace(oneRuneStr, ">", "&gt;", -1)
buf.content += oneRuneStr
@ -201,8 +198,6 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
}
oneRuneStr := string(r)
oneRuneStr = strings.Replace(oneRuneStr, "<", "&lt;", -1)
oneRuneStr = strings.Replace(oneRuneStr, ">", "&gt;", -1)
buf.content += oneRuneStr
@ -214,7 +209,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
if now-outputTimeout >= buf.millisecond || len(buf.content) > outputBufMax || oneRuneStr == "\n" {
channelRet["cmd"] = "run"
channelRet["output"] = "<span class='stderr'>" + buf.content + "</span>"
channelRet["output"] = buf.content
buf = outputBuf{} // a new buffer