strapi-provider-upload-azure-storage
strapi-provider-upload-azure-storage copied to clipboard
Invalid URL when uploading images using sasToken
Hi @jakeFeldman thanks for publishing v3.2.0; however, I have run into an error when uploading an image via the strapi media library when using the sasToken.
The BlobServiceClient throws a TypeError [ERR_INVALID_URL]: Invalid URL error. I believe its caused because the sasToken is just being appended to the baseUrl rather than being added as a query parameter:
return new BlobServiceClient(`${serviceBaseURL}${sasToken}`, anonymousCredential);
I believe it needs ? adding between the two variables:
return new BlobServiceClient(`${serviceBaseURL}?${sasToken}`, anonymousCredential);
For now can you add the "?" to your sasToken? I can patch and update the docs to reflect this later today.
Will do. Thanks @jakeFeldman
@jakeFeldman I would like to re-open this bug. Apparantly the urls that are stored in the database are too long. I get a "Data too long for column" error on the url field of the file. This is probably caused by the SASS token that is added in the database along with the file name.
Is this something that can be fixed?
@jakeFeldman I would like to re-open this bug. Apparantly the urls that are stored in the database are too long. I get a "Data too long for column" error on the url field of the file. This is probably caused by the SASS token that is added in the database along with the file name.
Is this something that can be fixed?
I encounter the same issue.
But I found a solution.
Don't use SAS at all.
Remove the sasToken property and use only accountKey
@kevinvugts sorry for the delayed response. The sasToken was added at a later date and the original implementation was for accountKey only. It's might be possible to fix what's gets saved to the db. Not sure if strapi exposes any apis that allow for this. Obviously this plugin doesn't write to the db directly.