Skip to content

Commit

Permalink
postUpload actually reads signature from querystring (#10432)
Browse files Browse the repository at this point in the history
  • Loading branch information
stereosteve authored Nov 14, 2024
1 parent c3faf1f commit 0531a5c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/mediorum/server/serve_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"

"github.com/AudiusProject/audius-protocol/pkg/mediorum/cidutil"
"github.com/AudiusProject/audius-protocol/pkg/mediorum/server/signature"

"github.com/labstack/echo/v4"
"github.com/oklog/ulid/v2"
Expand Down Expand Up @@ -130,9 +131,13 @@ func (ss *MediorumServer) postUpload(c echo.Context) error {
// read user wallet from ?signature query string
// ... fall back to (legacy) X-User-Wallet header
userWallet := sql.NullString{Valid: false}
if signerWallet, ok := c.Get("signer-wallet").(string); ok {

// updateUpload uses the requireUserSignature c.Get("signer-wallet")
// but requireUserSignature will fail request if missing
// so parse direclty here
if sig, err := signature.ParseFromQueryString(c.QueryParam("signature")); err == nil {
userWallet = sql.NullString{
String: signerWallet,
String: sig.SignerWallet,
Valid: true,
}
} else {
Expand Down

0 comments on commit 0531a5c

Please sign in to comment.