Skip to content

Conversation

@JimBobSquarePants
Copy link
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Fixes #233

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 PR addresses issue #233 by ensuring that invalid path extensions are properly skipped when validating input URLs. The fix modifies the TryGetExtensionFromUri method to validate both the path extension and query string format parameter, rejecting requests that have unsupported file extensions in the path even when a valid format is specified in the query string.

Key changes:

  • Modified the validation logic in FormatUtilities.TryGetExtensionFromUri to check path extensions before accepting query string format parameters
  • Added comprehensive test coverage for the new validation behavior
  • Updated sample code to demonstrate the corrected behavior

Reviewed Changes

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

File Description
src/ImageSharp.Web/FormatUtilities.cs Core logic changes to validate path extensions before accepting query format parameters
tests/ImageSharp.Web.Tests/Helpers/FormatUtilitiesTests.cs Added test case for rejecting invalid path extensions with valid query formats
samples/ImageSharp.Web.Sample/Pages/Index.cshtml Updated sample to use the corrected validation behavior

@JimBobSquarePants JimBobSquarePants merged commit 21efd0c into main Jul 31, 2025
8 checks passed
@JimBobSquarePants JimBobSquarePants deleted the js/fix-233 branch July 31, 2025 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants