Skip to content

Feat/url validation#284

Open
prakshithamalla-art wants to merge 3 commits into
vishnukothakapu:mainfrom
prakshithamalla-art:feat/url-validation
Open

Feat/url validation#284
prakshithamalla-art wants to merge 3 commits into
vishnukothakapu:mainfrom
prakshithamalla-art:feat/url-validation

Conversation

@prakshithamalla-art

Copy link
Copy Markdown
Contributor

Overview

Closes #270. Updated the isValidHttpUrl function in lib/url.ts to be more permissive with subdomains.

Changes Implemented

  • Removed the restrictive manual Regex check for schemes.
  • Refactored the function to use the native URL constructor with a fallback protocol. This allows the application to correctly validate and accept deep subdomains (e.g., a.b.c.example.com) while still maintaining security by enforcing http or https protocols.

Why this improves LinkID

  • Users can now save links to complex subdomains or project pages that were previously being rejected by the validation logic.

@vercel

vercel Bot commented May 30, 2026

Copy link
Copy Markdown

@prakshithamalla-art is attempting to deploy a commit to the vishnukothakapu's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@prakshithamalla-art, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 48 minutes and 17 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a011e934-9bfb-4b3d-affa-f5111e53bbeb

📥 Commits

Reviewing files that changed from the base of the PR and between f11e0d7 and e3156ab.

📒 Files selected for processing (3)
  • app/[username]/loading.tsx
  • components/ui/skeleton.tsx
  • lib/url.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
linkid Ready Ready Preview, Comment Jun 1, 2026 9:37am

@prakshithamalla-art

Copy link
Copy Markdown
Contributor Author

pls check this file and merge

@vedhapprakashni

Copy link
Copy Markdown
Collaborator

Hey @prakshithamalla-art.I reviewed the changes and have a few things to flag.

URL validation (lib/url.ts)

The simplification looks good and fixes the deep subdomain issue. However, the original code had an extra safety check that rejected non-HTTP schemes (like ftp://, javascript:, data://) early, before even trying to parse the URL:

if (hasScheme && !/^https?:/i.test(value)) {
return false;
}

Your new version removes this and only checks url.protocol after parsing. While that works in most cases, the early rejection was an extra layer of protection. Could you add it back while keeping your simplification? Something like:

export function isValidHttpUrl(value: string) {
try {
const hasScheme = value.includes("://");
if (hasScheme && !/^https?:///i.test(value)) {
return false;
}
const urlString = hasScheme ? value : https://${value};
const url = new URL(urlString);
return url.protocol === "http:" || url.protocol === "https:";
} catch {
return false;
}
}

This keeps your fix for deep subdomains while still rejecting bad schemes upfront.

Skeleton loader commits

The two skeleton loader commits (a572e63, 144c499) are for issue #271, which is a separate feature from the URL validation fix (#270). It would be better to move those into their own PR so each PR has a single purpose. Also, the second commit just fixes an import from the first one, so those could be squashed together.

Pls fix and lmk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix URL validation regex for subdomains

3 participants