Skip to content

Commit

Permalink
cleanup: Unnecessary use of bytes ˆ
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT2 committed Jan 8, 2024
1 parent 50559d2 commit e2c4f65
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"bytes"
"flag"
"fmt"
"io/fs"
Expand Down Expand Up @@ -116,7 +115,7 @@ func (ln tcpKeepaliveListener) Accept() (net.Conn, error) {

func RequestHandler(ctx *fasthttp.RequestCtx) {
// The authentication key provided with said Auth header
auth := ctx.Request.Header.Peek("Auth")
auth := string(ctx.Request.Header.Peek("Auth"))
method := string(ctx.Request.Header.Method())

// requestPath is prefixed with a /
Expand All @@ -139,7 +138,7 @@ func RequestHandler(ctx *fasthttp.RequestCtx) {
}

// Make sure Auth key is correct, or that we have an allowable user token
if !bytes.Equal(auth, authToken) && !VerifyUserToken(string(auth), method, path, ctx.FormValue("dir")) {
if (auth != authToken) && !VerifyUserToken(auth, method, path, ctx.FormValue("dir")) {
HandleForbidden(ctx)
return
}
Expand Down

0 comments on commit e2c4f65

Please sign in to comment.