From 0531a5c2f5305755ebef8ea9e699d13dbefef393 Mon Sep 17 00:00:00 2001 From: Steve Perkins Date: Wed, 13 Nov 2024 19:39:27 -0500 Subject: [PATCH] postUpload actually reads signature from querystring (#10432) --- pkg/mediorum/server/serve_upload.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/mediorum/server/serve_upload.go b/pkg/mediorum/server/serve_upload.go index e1e0cf2c519..b1b3d71d4d9 100644 --- a/pkg/mediorum/server/serve_upload.go +++ b/pkg/mediorum/server/serve_upload.go @@ -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" @@ -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 {