-
Notifications
You must be signed in to change notification settings - Fork 527
Description
Hi GrandNode Team,
While downloading order PDF invoices, I noticed the logo was not displayed despite having a logo uploaded.
Further investigation shows that the logo URL starts with a "/", resulting in an invisible logo.
In PictureService.GetThumbUrl, line 162, there is a call to _mediaFileStore.Combine, using the store location URL as first parameter:
grandnode2/src/Business/Grand.Business.Storage/Services/PictureService.cs
Lines 159 to 163 in 3278184
| protected virtual string GetThumbUrl(string thumbFileName, string storeLocation = null) | |
| { | |
| storeLocation = !string.IsNullOrEmpty(storeLocation) ? storeLocation : ""; | |
| return _mediaFileStore.Combine(storeLocation, ImageThumbPath, thumbFileName); | |
| } |
In IFileStoreExtensions.Combine, line 177, a "/" is added before the combined path if the path is not rooted, which works for local path but not for absolute url path:
grandnode2/src/Business/Grand.Business.Core/Interfaces/Storage/IFileStore.cs
Lines 176 to 179 in 3278184
| var combined = string.Join("/", normalizedParts); | |
| if (!Path.IsPathRooted(combined)) combined = "/" + combined; | |
| return combined; | |
| } |
There is only one single call to IFileStoreExtensions.Combine using an absolute URL as first parameter, so updating PictureService.GetThumbUrl might be the best place to fix the bug. This worked for me:
protected virtual string GetThumbUrl(string thumbFileName, string storeLocation = null)
{
storeLocation = !string.IsNullOrEmpty(storeLocation) ? storeLocation : string.Empty;
return storeLocation + _mediaFileStore.Combine(ImageThumbPath, thumbFileName);
}Do you see a better solution in order to fix this issue ?
Kind regards