Skip to content

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

Draft
Copilot wants to merge 3 commits intodevelopfrom
copilot/fix-pdf-invoice-logo-display
Draft

Fix store logo not appearing in PDF invoice when using absolute store URL#673
Copilot wants to merge 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
return _mediaFileStore.Combine(storeLocation, ImageThumbPath, thumbFileName);
storeLocation = !string.IsNullOrEmpty(storeLocation) ? storeLocation : string.Empty;
return storeLocation.TrimEnd('/') + _mediaFileStore.Combine(ImageThumbPath, thumbFileName);
}
Copy link
Copy Markdown
Member

@KrzysztofPajak KrzysztofPajak Apr 1, 2026

Choose a reason for hiding this comment

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

`
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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in aa5a594. Using new Uri(new Uri(storeLocation), thumbPath).ToString() to properly combine the base URL with the relative thumb path.

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

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

2 participants