Playground output escape
This commit is contained in:
parent
95cdebcc09
commit
38e16a4658
|
@ -20,7 +20,6 @@ import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/b3log/wide/conf"
|
"github.com/b3log/wide/conf"
|
||||||
|
@ -163,8 +162,6 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
oneRuneStr := string(r)
|
oneRuneStr := string(r)
|
||||||
oneRuneStr = strings.Replace(oneRuneStr, "<", "<", -1)
|
|
||||||
oneRuneStr = strings.Replace(oneRuneStr, ">", ">", -1)
|
|
||||||
|
|
||||||
buf.content += oneRuneStr
|
buf.content += oneRuneStr
|
||||||
|
|
||||||
|
@ -201,8 +198,6 @@ func RunHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
oneRuneStr := string(r)
|
oneRuneStr := string(r)
|
||||||
oneRuneStr = strings.Replace(oneRuneStr, "<", "<", -1)
|
|
||||||
oneRuneStr = strings.Replace(oneRuneStr, ">", ">", -1)
|
|
||||||
|
|
||||||
buf.content += oneRuneStr
|
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" {
|
if now-outputTimeout >= buf.millisecond || len(buf.content) > outputBufMax || oneRuneStr == "\n" {
|
||||||
channelRet["cmd"] = "run"
|
channelRet["cmd"] = "run"
|
||||||
channelRet["output"] = "<span class='stderr'>" + buf.content + "</span>"
|
channelRet["output"] = buf.content
|
||||||
|
|
||||||
buf = outputBuf{} // a new buffer
|
buf = outputBuf{} // a new buffer
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue