You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gz, err:=gzip.NewWriterLevel(w, gzip.BestSpeed) // BestSpeed is Much Faster than default - base on a very unscientific local test, and only ~30% larger (compression remains still very effective, ~6x)
132
+
gz, err:=gzip.NewWriterLevel(w, gzip.BestSpeed) // BestSpeed is Much Faster than default - base on a very unscientific local test
138
133
check(err)
139
134
defergz.Close()
140
135
tmpl.Execute(gz, p)
@@ -151,7 +146,8 @@ func doContent(w http.ResponseWriter, r *http.Request) {
151
146
152
147
path:=html.UnescapeString(r.URL.Path)
153
148
deferexitPath(w, "get content", path)
154
-
fullPath:=enforcePath(path)
149
+
fullPath, err:=enforcePath(path)
150
+
check(err)
155
151
stat, errStat:=os.Stat(fullPath)
156
152
check(errStat)
157
153
@@ -174,7 +170,9 @@ func upload(w http.ResponseWriter, r *http.Request) {
174
170
iferr!=nil&&err!=io.EOF { // errs EOF when no more parts to process
175
171
check(err)
176
172
}
177
-
dst, err:=os.Create(enforcePath(path))
173
+
path, err=enforcePath(path)
174
+
check(err)
175
+
dst, err:=os.Create(path)
178
176
check(err)
179
177
io.Copy(dst, part)
180
178
w.Write([]byte("ok"))
@@ -184,8 +182,9 @@ func zipRPC(w http.ResponseWriter, r *http.Request) {
0 commit comments