Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 16, 2025

Summary

Fixed the issue where relative links in clickable image badges were not being replaced with full URLs during package creation.

Changes Made

  • File: src/NuGetizer.Tasks/CreatePackage.cs

    • Updated regex pattern to handle image badges inside markdown links
    • Changed from [^\]]+ to !\[[^\]]*\]\([^\)]*\)|[^\]]+ to properly match nested brackets
  • File: src/NuGetizer.Tests/CreatePackageTests.cs

    • Added test case when_readme_has_clickable_image_badge_with_relative_url_then_replaces_url() to verify the fix
  • File: src/NuGetizer.Tests/Scenarios/given_multitargeting_libraries/uilibrary.csproj

    • Added SupportedOSPlatformVersion of 14.0 for maccatalyst to fix CI build error

Verification

✅ Both examples from the issue now work correctly:

  • [![EULA](https://img.shields.io/badge/EULA-OSMF-blue?labelColor=black&color=C9FF30)](osmfeula.txt) → relative URL is replaced
  • [![OSS](https://img.shields.io/github/license/devlooped/oss.svg?color=blue)](license.txt) → relative URL is replaced

✅ All existing test scenarios still work:

  • Simple links: [text](url)
  • Image links: ![alt](url)
  • Links with titles: [text](url "title")
  • Absolute URLs are not replaced (preserved as-is)

✅ Fixed unrelated CI test failure for maccatalyst platform version

Original prompt

This section details on the original issue you should resolve

<issue_title>Relative links used after an image link aren't properly replaced with full URLs</issue_title>
<issue_description>These aren't being replaced at all:

[![EULA](https://img.shields.io/badge/EULA-OSMF-blue?labelColor=black&color=C9FF30)](osmfeula.txt)
[![OSS](https://img.shields.io/github/license/devlooped/oss.svg?color=blue)](license.txt) 

Back this issue
Back this issue

Comments on the Issue (you are @copilot in this section)

Fixes #656


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Fix replacement of relative links after image links Fix regex pattern to handle clickable image badges with relative URLs Oct 16, 2025
Copilot AI requested a review from kzu October 16, 2025 18:18
Copilot finished work on behalf of kzu October 16, 2025 18:18
@kzu kzu marked this pull request as ready for review October 16, 2025 18:20
@kzu kzu enabled auto-merge (squash) October 16, 2025 18:21
@kzu
Copy link
Member

kzu commented Oct 16, 2025

305 passed 305 passed 1 skipped

🧪 Details on Microsoft Windows 10.0.26100

from dotnet-retest v1.0.0 on .NET 9.0.9 with 💜 by @devlooped

@kzu
Copy link
Member

kzu commented Oct 16, 2025

@copilot there seems to be an unrelated test failure in the CI build:

D:\a\nugetizer\nugetizer\src\NuGetizer.Tests\bin\Release\net472\Scenarios\given_multitargeting_libraries\uilibrary.csproj
 Target: Build
 The workload 'net8.0-maccatalyst' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/maui-support-policy for more information about the support policy.
 1.0 is not a valid TargetPlatformVersion for maccatalyst. Valid versions include:
 None


 1.0 is not a valid TargetPlatformVersion for maccatalyst. Valid versions include:

...
NuGetizer.given_multitargeting_libraries.when_packing_on_build_then_succeeds(pro
jectName: "uilibrary.csproj")
     Assert.Equal() Failure: Values differ                                      
     Expected: Success                                                          
     Actual:   Failure                                                          
        at Builder.TargetResult.AssertSuccess(ITestOutputHelper output) in      
     /_/src/NuGetizer.Tests/Builder.NuGetizer.cs:line 206                       
        at                                                                      
     NuGetizer.given_multitargeting_libraries.when_packing_on_build_then_succeed
     s(String projectName) in                                                   
     /_/src/NuGetizer.Tests/given_multitargeting_libraries.cs:line 29         

perhaps try updating that to .net 10?

…formVersion

Add SupportedOSPlatformVersion of 14.0 for net8.0-maccatalyst to fix the build error:
"1.0 is not a valid TargetPlatformVersion for maccatalyst"

Co-authored-by: kzu <[email protected]>
Copy link
Contributor Author

Copilot AI commented Oct 16, 2025

@copilot there seems to be an unrelated test failure in the CI build:

...

Fixed in commit {{commit_hash}}. Added SupportedOSPlatformVersion of 14.0 for the maccatalyst target framework, which is the minimum supported version for .NET 8 Mac Catalyst apps.

auto-merge was automatically disabled October 16, 2025 18:54

Head branch was pushed to by a user without write access

Copilot AI requested a review from kzu October 16, 2025 18:54
Copilot finished work on behalf of kzu October 16, 2025 18:54
@kzu kzu merged commit e0e6cf7 into main Oct 16, 2025
5 checks passed
@kzu kzu deleted the copilot/fix-relative-links-issue branch October 16, 2025 19:40
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.

Relative links used after an image link aren't properly replaced with full URLs

2 participants