vc-platform
vc-platform copied to clipboard
Specifying fileblobstorage public relative URL generates exception
Expected behavior
setting connection string for blobstorage to: provider=LocalStorage;rootPath=~/App_Data/Assets;publicUrl=/assets
should produce assets URLs: http://{admin-url}/assets/{name_of_asset}
also shouldn't crash admin catalog product browsing screen with 500 error.
Actual behavior
The following error is returned (and admin product browsing returns 500 error):
{"message":"An error has occurred.","exceptionMessage":"Invalid URI: The format of the URI could not be determined.","exceptionType":"System.UriFormatException","stackTrace":" at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)\r\n at VirtoCommerce.Platform.Data.Assets.FileSystemBlobProvider.GetAbsoluteUrl(String relativeUrl)\r\n at VirtoCommerce.CatalogModule.Web.Converters.AssetConverter.ToWebModel(Image image, IBlobUrlResolver blobUrlResolver)\r\n at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext()\r\n at System.Collections.Generic.List
1..ctor(IEnumerable1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)\r\n at VirtoCommerce.CatalogModule.Web.Converters.CategoryConverter.ToWebModel
Steps to reproduce
- Change configuration publicIUrl to "/assets".
I have the same issue here with some extended method I wrote. https://github.com/VirtoCommerce/vc-module-image-tools/blob/master/VirtoCommerce.ImageToolsModule.Data/Services/ThumbnailService.cs#L138 This line fails when I set the AssetsConnectionString to provider=LocalStorage;rootPath=~/App_Data/Assets;publicUrl=http://localhost/admin/assets but it starts working when I set it to a proper Azure Blob Storage connectionstring. So, I think that means that it's never going to process images if we are using the local assets folder.
@Skrypt it should be a simple fix, it is just putting value to Uri ctor, but it should actually construct correct URL and handle any exception in there.
Does the BlobStorageProvider.OpenRead(imageUrl)) has a fallback to normal local folders? Else maybe the provider name is confusing.
It depends on the provider used, if it is filebased, then it uses local folder.