Search code examples
goobject-storageminio

How to use Minio presigned URLs with Go


Goal:

Implement reading Minio objects through signed URLs (using github.com/minio/minio-go/v6)

Attempt:

I followed the example from github: https://github.com/minio/minio-go/blob/master/examples/s3/presignedgetobject.go

and using PresignedGetObject(), I end up with a net/url struct. When I concatenate the url.Host and url.Path value the result is something like: localhost:9000/inputs/2ea471a5521c.pdb. Which simply links to the object in Minio UI.

I expected the client to generate a signed URL that enables downloading the object when queried with curl or else, something like this in Google Cloud Storage: https://cloud.google.com/storage/docs/access-control/signed-urls#example

Am I missing some additional logic or have I misinterpreted what minio pre-signed URLs are? Thank you.


Solution

  • If you want the presigned url as string you can simply call

    presignedURL.String()
    

    https://golang.org/pkg/net/url/#URL.String