Skip to content

Conversation

@binon
Copy link
Collaborator

@binon binon commented Jun 13, 2025

…ent hadnling of '/' in urls'

JIRA link

TD-####

Description

Describe what has changed and how that will affect the app. If relevant, add links to any sources/documentation you used. Highlight anything unusual and give people context around particular decisions.

Screenshots

Paste screenshots for all views created or changed: mobile, tablet and desktop, wave analyser showing no errors.


Developer checks

(Leave tasks unticked if they haven't been appropriate for your ticket.)

I have:

  • Run the IDE auto formatter on all files I’ve worked on and made sure there are no IDE errors relating to them
  • Written or updated tests for the changes (accessibility ui tests for views, tests for controller, data services, services, view models created or modified) and made sure all tests are passing
  • Manually tested my work with and without JavaScript (adding notes where functionality requires JavaScript)
  • Tested any Views or partials created or changed with Wave Chrome plugin. Addressed any valid accessibility issues and documented any invalid errors
  • Updated my Jira ticket with testing notes, including information about other parts of the system that were touched as part of the MR and need to be tested to ensure nothing is broken
  • Scanned over my pull request in GitHub and addressed any warnings from the GitHub Build and Test checks in the GitHub PR ‘Files Changed’ tab
    Either:
  • Documented my work in Confluence, updating any business rules applied or modified. Updated GitHub readme/documentation for the repository if appropriate. List of documentation links added/changed:
  • Confirmed that none of the work that I have undertaken requires any updates to documentation

@binon binon requested review from AnjuJose011 and Copilot June 13, 2025 13:19
Copy link

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

This pull request fixes an issue related to local fallback image downloading and URL concatenation for course resources. Key changes include:

  • Removing the extra slash between the base URL and path in URL concatenation.
  • Updating the course image rendering to use an tag with an onerror attribute instead of an tag for SVG images.

    Reviewed Changes

    Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

    File Description
    LearningHub.Nhs.WebUI/Views/Search/_ResourceSearchResult.cshtml Modified URL concatenation to remove the redundant slash between apiBaseUrl and path.
    LearningHub.Nhs.WebUI/Views/Home/_CourseEnrolled.cshtml Adjusted URL concatenation similarly and updated the SVG image rendering to use an tag with an onerror fallback.
    Comments suppressed due to low confidence (2)

    LearningHub.Nhs.WebUI/Views/Search/_ResourceSearchResult.cshtml:41

    • Ensure that 'apiBaseUrl' includes a trailing slash when appropriate, or dynamically insert a separator to avoid potential URL concatenation issues.
    string returnUrl = $@"{apiBaseUrl}{path}?id={courseId}";
    

    LearningHub.Nhs.WebUI/Views/Home/_CourseEnrolled.cshtml:15

    • Make sure that 'apiBaseUrl' consistently ends with a slash, or modify the concatenation logic to conditionally add a '/' to maintain reliable URL formation.
    string returnUrl = $@"{apiBaseUrl}{path}?id={courseId}";
    

<object class="nhsuk-card__img nhsuk-card-banner" type="image/svg+xml" data="@Model.CourseImage">
<img src="/images/default-course.jpg" alt="Fallback image" />
</object>
<img class="nhsuk-card__img nhsuk-card-banner" src="@Model.CourseImage" alt="Course image" onerror="this.onerror=null;this.src='/images/default-course.jpg';" />
Copy link

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider reviewing the alt attribute to ensure that the fallback image conveys sufficient context for users relying on assistive technologies.

Copilot uses AI. Check for mistakes.
@binon binon merged commit 58a456d into RC Jun 13, 2025
3 checks passed
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.

2 participants