Skip to content

Commit

Permalink
Merge pull request #58 from yukimochi/fix/ioread-v1.1.2
Browse files Browse the repository at this point in the history
fix: use io.ReadAll() insteadof Body.Read().
  • Loading branch information
yukimochi authored Nov 20, 2022
2 parents a1cccf0 + 9bf3151 commit 99ce362
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions api/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ import (
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"strconv"

"github.com/go-fed/httpsig"
"github.com/yukimochi/Activity-Relay/models"
)

func decodeActivity(request *http.Request) (*models.Activity, *models.Actor, []byte, error) {
request.Header.Set("Host", request.Host)
dataLen, _ := strconv.Atoi(request.Header.Get("Content-Length"))
body := make([]byte, dataLen)
request.Body.Read(body)
body, err := io.ReadAll(request.Body)

// Verify HTTPSignature
verifier, err := httpsig.NewVerifier(request)
Expand Down

0 comments on commit 99ce362

Please sign in to comment.