Skip to content

fix: validate URLs for homepage field and repository field#21

Merged
sapphi-red merged 4 commits intomainfrom
copilot/add-url-validation-checks
Feb 6, 2026
Merged

fix: validate URLs for homepage field and repository field#21
sapphi-red merged 4 commits intomainfrom
copilot/add-url-validation-checks

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

The npm URL from searchResult.package.links.npm is now passed through without validation since it originates from npm's API.

Changes

  • Removed validation logic and warning logs for npm URLs
  • npm link now uses searchResult.package.links.npm directly
  • Repository and homepage URLs remain validated for http/https protocols

Before:

const npmUrl = searchResult.package.links.npm
const validatedNpmUrl = validateUrl(npmUrl)
if (!validatedNpmUrl) {
  console.warn(`Warning: Invalid npm URL for ${searchResult.package.name}: ${npmUrl}`)
}

links: {
  npm: validatedNpmUrl ?? npmUrl,
  repository: validateUrl(...),
  homepage: validateUrl(...),
}

After:

links: {
  npm: searchResult.package.links.npm,
  repository: validateUrl(...),
  homepage: validateUrl(...),
}
Original prompt

Add validation here that checks that the url can be parsed with new URL and has a http protocol or https protocol

npm: searchResult.package.links.npm,
repository:
extractRepositoryUrl(versionData?.repository) ?? searchResult.package.links.repository,
homepage: versionData?.homepage ?? searchResult.package.links.homepage,


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@netlify
Copy link

netlify bot commented Feb 6, 2026

Deploy Preview for vite-plugin-registry ready!

Name Link
🔨 Latest commit 22c7854
🔍 Latest deploy log https://app.netlify.com/projects/vite-plugin-registry/deploys/6985695ade80880008cb3cf8
😎 Deploy Preview https://deploy-preview-21--vite-plugin-registry.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI and others added 2 commits February 6, 2026 03:49
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Copilot AI changed the title [WIP] Add validation for URL parsing and protocol checks Add URL validation for http/https protocols in plugin links Feb 6, 2026
Copilot AI requested a review from sapphi-red February 6, 2026 03:57
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Copilot AI changed the title Add URL validation for http/https protocols in plugin links Skip URL validation for npm links from search results Feb 6, 2026
@sapphi-red sapphi-red changed the title Skip URL validation for npm links from search results fix: validate URLs for homepage field and repository field Feb 6, 2026
@sapphi-red sapphi-red marked this pull request as ready for review February 6, 2026 04:23
@sapphi-red sapphi-red merged commit 793fe9f into main Feb 6, 2026
9 checks passed
@sapphi-red sapphi-red deleted the copilot/add-url-validation-checks branch February 6, 2026 04:42
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