2020IP / TwentyTwenty.Storage

A cross-cloud storage abstraction
Other
100 stars 26 forks source link

GetBlobUrl in AmazonStorageProvider url invalid #2

Closed Fabioh closed 7 years ago

Fabioh commented 8 years ago

I had a problem with the method "GetBlobUrl" in a instance of an object "AmazonStorageProvider", the generated url doesn't follows the AWS patterns like these:

Reference: http://stackoverflow.com/questions/34993366/how-to-get-public-url-after-uploading-image-to-s3

Could you please verify this issue.

Best regards, Fábio Henrique Gabriele

jarroda commented 7 years ago

I just tested this and it appears to be working correctly for me. I generated a random blob in a random container (prefix in AWS speak) and GetBlobUrl returned

https://s3.amazonaws.com/2020-storage-test/storagetest-a637fa32b9474015903f71bcfe460e0f/fd5a92f7129c4a05ab37b35e773653cb This appears to be a correctly formatted URL for this blob, and in fact does work.

The code for this is quite simple.

public string GetBlobUrl(string containerName, string blobName)
{
    return $"{_serviceUrl}/{_bucket}/{GenerateKeyName(containerName, blobName)}";
}

Is your service url changed to something that is causing an invalid URL to be generated?

jarroda commented 7 years ago

Will reopen this if it is still an issue.