Fix store logo not appearing in PDF invoice when using absolute store URL#673
Fix store logo not appearing in PDF invoice when using absolute store URL#673
Conversation
…URL handling Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/5d80e0b7-d5a1-4e18-81b0-0a71e3c14373 Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
| return _mediaFileStore.Combine(storeLocation, ImageThumbPath, thumbFileName); | ||
| storeLocation = !string.IsNullOrEmpty(storeLocation) ? storeLocation : string.Empty; | ||
| return storeLocation.TrimEnd('/') + _mediaFileStore.Combine(ImageThumbPath, thumbFileName); | ||
| } |
There was a problem hiding this comment.
`
var thumbPath = _mediaFileStore.Combine(ImageThumbPath, thumbFileName);
if (string.IsNullOrEmpty(storeLocation))
return thumbPath;
return new Uri(new Uri(storeLocation), thumbPath).ToString();
`
@copilot Maybe this way will be more professional?
There was a problem hiding this comment.
Updated in aa5a594. Using new Uri(new Uri(storeLocation), thumbPath).ToString() to properly combine the base URL with the relative thumb path.
Agent-Logs-Url: https://github.com/grandnode/grandnode2/sessions/19f059e0-4b1b-4db9-b30b-56e92247bc80 Co-authored-by: KrzysztofPajak <16772986+KrzysztofPajak@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|



PictureService.GetThumbUrlpassed the absolute store URL intoIFileStoreExtensions.Combine, which callsPath.IsPathRootedto decide whether to prepend/. SincePath.IsPathRooted("https://...")returnsfalse,Combineproduced/https://example.com/assets/images/thumbs/logo.jpg— an invalid URL that rendered as a broken image in PDF invoices.Changes
PictureService.GetThumbUrl: Only pass the relative thumb path toCombine; use theUriclass to properly resolve the absolute URL:PictureServiceTests: AddedTestablePictureServicesubclass to expose the protected method, plus two tests covering the absolute-URL and empty store location cases.