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>
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:
|
|
There was a problem hiding this comment.
Pull request overview
Fixes incorrect thumbnail URL construction when storeLocation is an absolute URL (e.g., https://...), which previously produced invalid paths like /https://example.com/... and caused broken images (notably in PDF invoices).
Changes:
- Updated
PictureService.GetThumbUrlto build the thumb path independently and then resolve it againststoreLocationusingUri. - Added a
TestablePictureServicehelper to expose the protectedGetThumbUrlfor testing. - Added tests covering absolute
storeLocationand missingstoreLocationcases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Business/Grand.Business.Storage/Services/PictureService.cs |
Fixes URL construction by avoiding Combine with absolute URLs and using Uri to resolve correctly. |
src/Tests/Grand.Business.Storage.Tests/Services/PictureServiceTests.cs |
Adds regression tests for absolute store URL handling and the relative-path fallback when store location is empty/null. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



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.