Skip to content

fix: sanitize social URLs by stripping leading @ symbols and correctl… - #6582

Open
desireddymohithreddy0925 wants to merge 2 commits into
JhaSourav07:mainfrom
desireddymohithreddy0925:fix-double-at-social-urls-6499
Open

fix: sanitize social URLs by stripping leading @ symbols and correctl…#6582
desireddymohithreddy0925 wants to merge 2 commits into
JhaSourav07:mainfrom
desireddymohithreddy0925:fix-double-at-social-urls-6499

Conversation

@desireddymohithreddy0925

Copy link
Copy Markdown
Contributor

Fixes #6499

Description
This PR fixes a bug where social platforms with base URLs ending in @ (such as TikTok, YouTube, Medium) generated invalid profile links with duplicated @@ symbols if users manually included the @ symbol in their handles. A resolveSocialUrl helper was introduced to safely normalize social link inputs before URL construction. The logic intelligently strips leading @ symbols if the baseUrl already includes it and defaults to using the raw user input if they typed an absolute http(s):// URL. The helper was applied to both the README generator logic and the live frontend link preview component. Unit tests for resolveSocialUrl have been added to verify these behaviors.

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally.
  • I have run npm run format and npm run lint locally and resolved all errors.
  • My commits follow the Conventional Commits format.

@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Someone is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

Asset PR Size Base Size Difference Status
static/chunks/app/generator/page-[hash].js 28.74 KB 28.68 KB +0.07 KB (+0.23%) 🔴 Regression

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 3914.98 KB 3914.83 KB +0.15 KB (+0.00%)
Total CSS 319.21 KB 319.21 KB 0 B

@Aamod007 Aamod007 added level:beginner Small changes Usually isolated fixes or simple UI/text updates. quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. bug Something isn't working feature A completely new feature or major addition to the project. mentor:Aamod007 labels Jun 25, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hey there! Thanks for fixing the social URL sanitization. Handling leading @ symbols correctly will definitely improve the UX when adding social links.

For the labels: I'm assigning level:beginner because the change primarily involves string manipulation in the resolveSocialUrl helper. I'm adding quality:clean for the clean implementation and test coverage. The bug and feature labels are added as this fixes incorrect URL generation.

Unfortunately, the Vercel build check is failing. Please take a look at the Vercel logs to resolve the issue so we can get this merged!

@Aamod007 Aamod007 added type:bug Something isn't working as expected type:feature New features, additions, or enhancements labels Jun 25, 2026
@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jun 25, 2026
@desireddymohithreddy0925
desireddymohithreddy0925 force-pushed the fix-double-at-social-urls-6499 branch from 284f1ae to f6111b6 Compare June 25, 2026 18:31
@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jun 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Hey @desireddymohithreddy0925, this pull request has been inactive for 3 days. It will be automatically closed in 2 days if no further activity occurs.

If you are still working on this, please push your latest changes or leave a comment to keep it active.

@Aamod007 Aamod007 added the level:intermediate Moderate complexity tasks label Jul 2, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hey! Thanks for pushing updates to address the feedback. Unfortunately, it looks like this PR is currently blocked (due to failing CI checks, merge conflicts, etc.). We can't approve or proceed with the review until the build is green. Please resolve these issues, and let me know if you need any help debugging!

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-reviewing: We are ignoring the Vercel/CI failures as per the latest update. Your code changes look solid. Approving!

@Aamod007 Aamod007 removed the level:intermediate Moderate complexity tasks label Jul 15, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sanitizing social URLs by stripping leading @ symbols in validations.ts cleanly fixes user input errors. However, the CI checks are failing. Please resolve the issues and rerun the CI pipeline.

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Upon re-evaluation, I realized I previously misinterpreted the Vercel deployment failure as an issue with this PR. The Vercel build failure seems unrelated to the changes introduced here, so I will ignore it moving forward. The rest of the PR looks good, so I'm approving it!

@Aamod007 Aamod007 added level:intermediate Moderate complexity tasks type:refactor Code changes that neither fix a bug nor add a feature and removed level:beginner Small changes Usually isolated fixes or simple UI/text updates. labels Jul 23, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is an excellent refactoring! Extracting the URL resolution into a centralized function and providing full test coverage is the right way to handle this issue. Great job!

However, your branch currently has merge conflicts with the \main\ branch (indicated by the
eeds-rebase\ label). Please rebase your branch on the latest \main\ to resolve these conflicts.

Once the conflicts are resolved, we can get this merged!

Label Justification:

  • \level:intermediate: Refactoring core logic into a reusable utility and writing a dedicated unit test suite makes this an intermediate contribution.
  • \quality:clean: The code is well-structured and thoroughly tested.
  • \ ype:bug\ & \ ype:refactor: Fixes broken URLs by refactoring the resolution logic.
  • \mentor:Aamod007: Assigned as required.

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for resolving the merge conflicts and getting this rebased on \main! The refactoring and test coverage here is excellent.

Approving this PR! (Note: The \gssoc:needs-rebase\ label has been removed since conflicts are resolved.)

Label Justification:

  • \level:intermediate: Refactoring core logic into a reusable utility and writing a dedicated unit test suite.
  • \quality:clean: Well-structured code and thoroughly tested.
  • \ ype:bug, \ ype:refactor, \ ype:feature: Fixes broken URLs, extracts resolution logic, and improves URL handling.
  • \mentor:Aamod007: Assigned as required.

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jul 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚨 Hey @desireddymohithreddy0925, the CI Pipeline is failing on this PR and it has been marked as status:blocked.

Please fix the issues before this can be reviewed. Here's how:

1. Run checks locally before pushing:

npm run format:check   # Check Prettier formatting
npm run lint           # Run ESLint
npm run typecheck      # TypeScript type check
npm run test           # Run unit tests (Vitest)
npm run build          # Verify production build passes

2. Auto-fix common issues:

npm run format         # Auto-fix formatting with Prettier
npm run lint -- --fix  # Auto-fix lint errors where possible

3. Check the full failure log here:
👉 View CI Run

Once you push a fix and the CI passes, the status:blocked label will be removed automatically. 💪

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This PR was approved but currently has failing CI checks. Please resolve the CI failures before merging.

@Aamod007 Aamod007 removed bug Something isn't working feature A completely new feature or major addition to the project. labels Jul 27, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Update: the CI failure is Vercel authorization only (not code-related). All actual code checks pass. The original approval stands — Vercel deploy auth is a repo config issue.

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

Labels

level:intermediate Moderate complexity tasks mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. status:blocked This PR is blocked due to a failing CI check. type:bug Something isn't working as expected type:feature New features, additions, or enhancements type:refactor Code changes that neither fix a bug nor add a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: baseUrl concatenation creates duplicated @ symbols for some platforms

3 participants