Skip to content

Fix store logo not appearing in PDF invoice when using absolute store URL#673

Merged
KrzysztofPajak merged 3 commits intodevelopfrom
copilot/fix-pdf-invoice-logo-display
Apr 10, 2026
Merged

Fix store logo not appearing in PDF invoice when using absolute store URL#673
KrzysztofPajak merged 3 commits intodevelopfrom
copilot/fix-pdf-invoice-logo-display

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

PictureService.GetThumbUrl passed the absolute store URL into IFileStoreExtensions.Combine, which calls Path.IsPathRooted to decide whether to prepend /. Since Path.IsPathRooted("https://...") returns false, Combine produced /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 to Combine; use the Uri class to properly resolve the absolute URL:
// Before
return _mediaFileStore.Combine(storeLocation, ImageThumbPath, thumbFileName);

// After
var thumbPath = _mediaFileStore.Combine(ImageThumbPath, thumbFileName);
if (string.IsNullOrEmpty(storeLocation))
    return thumbPath;

return new Uri(new Uri(storeLocation), thumbPath).ToString();
  • PictureServiceTests: Added TestablePictureService subclass to expose the protected method, plus two tests covering the absolute-URL and empty store location cases.

AzurePictureService and AmazonPictureService both override GetThumbUrl with their own URL construction and are unaffected.

…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>
Copilot AI changed the title [WIP] Fix logo display issue in order PDF invoice Fix store logo not appearing in PDF invoice when using absolute store URL Apr 1, 2026
Copilot AI requested a review from KrzysztofPajak April 1, 2026 19:11
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 1, 2026

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:

  • ccsca2021.crl.certum.pl
    • Triggering command: /usr/share/dotnet/dotnet dotnet test src/Tests/Grand.Business.Storage.Tests/Grand.Business.Storage.Tests.csproj (dns block)
  • ccsca2021.ocsp-certum.com
    • Triggering command: /usr/share/dotnet/dotnet dotnet test src/Tests/Grand.Business.Storage.Tests/Grand.Business.Storage.Tests.csproj (dns block)
  • crl.certum.pl
    • Triggering command: /usr/share/dotnet/dotnet dotnet test src/Tests/Grand.Business.Storage.Tests/Grand.Business.Storage.Tests.csproj (dns block)
  • subca.ocsp-certum.com
    • Triggering command: /usr/share/dotnet/dotnet dotnet test src/Tests/Grand.Business.Storage.Tests/Grand.Business.Storage.Tests.csproj (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 1, 2026

@KrzysztofPajak KrzysztofPajak marked this pull request as ready for review April 10, 2026 18:13
Copilot AI review requested due to automatic review settings April 10, 2026 18:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.GetThumbUrl to build the thumb path independently and then resolve it against storeLocation using Uri.
  • Added a TestablePictureService helper to expose the protected GetThumbUrl for testing.
  • Added tests covering absolute storeLocation and missing storeLocation cases.

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.

@KrzysztofPajak KrzysztofPajak merged commit d6f1014 into develop Apr 10, 2026
10 checks passed
@KrzysztofPajak KrzysztofPajak deleted the copilot/fix-pdf-invoice-logo-display branch April 10, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot display store logo in order PDF invoice to path error

3 participants