Skip to content

Commit f7e302e

Browse files
committed
Simplify sanitize buffer pooling
1 parent a9e16b2 commit f7e302e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

middleware/static/static.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,8 @@ func sanitizePath(p []byte, filesystem fs.FS) ([]byte, error) {
5050
hasTrailingSlash := len(p) > 0 && p[len(p)-1] == '/'
5151

5252
if bytes.IndexByte(p, '\\') >= 0 {
53-
buf, ok = sanitizeBufPool.Get().([]byte)
54-
if !ok {
55-
buf = nil
56-
} else {
57-
pooledBuf = buf
58-
}
53+
buf = sanitizeBufPool.Get().([]byte)
54+
pooledBuf = buf
5955
if cap(buf) < len(p) {
6056
if pooledBuf != nil {
6157
putSanitizeBuf(pooledBuf)

0 commit comments

Comments
 (0)