Skip to content

Fix image path resolution in Agent08 using IWebHostEnvironment#3

Merged
pournasserian merged 2 commits into
ui-enhancementfrom
copilot/sub-pr-1-again
Mar 11, 2026
Merged

Fix image path resolution in Agent08 using IWebHostEnvironment#3
pournasserian merged 2 commits into
ui-enhancementfrom
copilot/sub-pr-1-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 11, 2026

File.ReadAllBytesAsync("wwwroot/image.jpg") resolves relative to the process working directory, which breaks when the app is hosted with a non-default content root.

Changes

  • Agent08.razor: Inject IWebHostEnvironment and resolve the image path via WebRootPath
// Before
var imageData = await File.ReadAllBytesAsync("wwwroot/image.jpg");

// After
@inject IWebHostEnvironment WebHostEnvironment
// ...
var imageData = await File.ReadAllBytesAsync(Path.Combine(WebHostEnvironment.WebRootPath, "image.jpg"));

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copy link
Copy Markdown
Contributor

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.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@pournasserian pournasserian added the enhancement New feature or request label Mar 11, 2026
Co-authored-by: pournasserian <24959477+pournasserian@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on CSS variables and agent page redesign Fix image path resolution in Agent08 using IWebHostEnvironment Mar 11, 2026
@pournasserian pournasserian marked this pull request as ready for review March 11, 2026 23:49
@pournasserian pournasserian merged commit 247dd72 into ui-enhancement Mar 11, 2026
@pournasserian pournasserian deleted the copilot/sub-pr-1-again branch March 11, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants