Skip to content

🐛 Fixed LinkedIn company and school URLs with underscores being rejected as invalid - #30490

Merged
louisghost merged 1 commit into
mainfrom
fix-underscores-in-linkedin-urls
Sep 3, 2026
Merged

louisghost merged 1 commit into
mainfrom
fix-underscores-in-linkedin-urls

Conversation

@louisghost

@louisghost louisghost commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • LinkedIn company/school profile URLs that contain underscores (e.g. https://www.linkedin.com/company/eyeshot_2/) were rejected with "Your Username is not a valid LinkedIn Username"
  • Company and school path types now use a username rule that allows _ in addition to hyphens; personal /in/ and /pub/ profiles stay hyphen-only
  • Adds coverage for eyeshot_2 / underscore company+school URLs, and for rejecting underscores on personal handles

History

This is not a new limitation — an earlier fix never landed after the social-validator refactor.

PR Intent Outcome
#28893 Allow _ in company/school URLs — used exactly eyeshot_2 as the example Closed as “fixed in #29051”
#29022 Unicode / accented company slugs Closed in favour of #29051
#29051 Wholesale social-validator refactor Merged — fixed unicode, not underscores

#29051 only covered the unicode issue (ONC-1856 / #29022). Closing #28893 as fixed was a miss: the refactor set extra: '-' (hyphen only) and never added _. #28893 itself cannot be revived — it patches the pre-refactor admin-x-settings validator/tests that no longer exist.

Test plan

  • pnpm test:unit src/settings/utils/social-urls/social-urls.test.ts (100 passed)
  • Confirm Settings → Social accounts accepts https://www.linkedin.com/company/eyeshot_2/
  • Confirm personal /in/john_smith is still rejected

@coderabbitai

coderabbitai Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Team

Run ID: 3e9d573c-3136-4b01-8a89-d17d756b5fac

📥 Commits

Reviewing files that changed from the base of the PR and between 2b7192e and f945e6f.

📒 Files selected for processing (2)
  • apps/admin/src/settings/utils/social-urls/linkedin.ts
  • apps/admin/src/settings/utils/social-urls/social-urls.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (12)
  • GitHub Check: Unit tests (Node 22.23.1)
  • GitHub Check: Unit tests (Node 24.20.0)
  • GitHub Check: Build Docker Images
  • GitHub Check: Build E2E Public App Assets
  • GitHub Check: Build Admin
  • GitHub Check: Stripe fixture checks
  • GitHub Check: Lint
  • GitHub Check: App Playwright Acceptance Tests (@tryghost/admin)
  • GitHub Check: Check migration integrity
  • GitHub Check: Check app version bump
  • GitHub Check: Detect Tinybird changes
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (7)
Review Admin UI for existing Shade reuse, correct component layer, semantic tokens, accessible interaction states, and whole-sentence translations.

⚙️ CodeRabbit configuration file

Files:

  • apps/admin/src/settings/utils/social-urls/linkedin.ts
  • apps/admin/src/settings/utils/social-urls/social-urls.test.ts
Review whether tests prove changed behaviour, meaningful error/edge paths, and externally observable contracts without coupling to implementation details.

⚙️ CodeRabbit configuration file

Files:

  • apps/admin/src/settings/utils/social-urls/social-urls.test.ts
Review lens: "where does this data become trusted?" Boundary data (HTTP input, external API/SDK responses, env/config, DB/filesystem reads, queue/webhook/event payloads) is `unknown` until validated — Zod by default.

⚙️ CodeRabbit configuration file

Files:

  • apps/admin/src/settings/utils/social-urls/linkedin.ts
  • apps/admin/src/settings/utils/social-urls/social-urls.test.ts
Prioritise concrete correctness, security, data-integrity, compatibility, and regression risks.

⚙️ CodeRabbit configuration file

Files:

  • apps/admin/src/settings/utils/social-urls/linkedin.ts
  • apps/admin/src/settings/utils/social-urls/social-urls.test.ts
Type-safe boundaries: Fail only if the PR: consumes boundary data (HTTP input, external API/SDK responses, env/config, DB/filesystem reads, queue/webhook/event payloads) without validating it first — Zod by default, another format only wher...

📄 CodeRabbit inference engine (Custom checks)

Files:

  • apps/admin/src/settings/utils/social-urls/linkedin.ts
  • apps/admin/src/settings/utils/social-urls/social-urls.test.ts
Build new features in React, use `admin-x-framework` for APIs, and use Shade for UI.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • apps/admin/src/settings/utils/social-urls/linkedin.ts
  • apps/admin/src/settings/utils/social-urls/social-urls.test.ts
Always use `pnpm`, never npm or Yarn.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • apps/admin/src/settings/utils/social-urls/linkedin.ts
  • apps/admin/src/settings/utils/social-urls/social-urls.test.ts
🔇 Additional comments (2)
apps/admin/src/settings/utils/social-urls/linkedin.ts (1)

7-18: LGTM!

Also applies to: 34-35

apps/admin/src/settings/utils/social-urls/social-urls.test.ts (1)

475-478: LGTM!

Also applies to: 491-491, 504-505, 516-516, 535-535


Walkthrough

LinkedIn validation now uses a dedicated username rule for /company/ and /school/ paths. This rule allows underscores. Personal /in/ and /pub/ paths retain the existing restrictions. Tests cover URL normalization, handle conversion, stored handle extraction, and rejection of underscores in personal profile URLs.

Suggested reviewers: 9larsons

Merge Risk: ⚪ Minimal · up to f945e

LinkedIn company and school URLs with underscores are now accepted while personal profile URLs retain their existing restrictions. The intended behavior is covered without an identified merge-readiness risk.

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: allowing underscores in LinkedIn company and school URLs while keeping the scope specific.
Description check ✅ Passed The description directly explains the LinkedIn validation change, the distinction between company/school and personal URLs, and the added test coverage.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Type-Safe Boundaries ✅ Passed The PR changes only the typed LinkedIn UsernameRule configuration and assigns the new rule to company/ and school/ path types. The shared validator still compiles and checks the username before …
New Files Are Typescript ✅ Passed The PR changes only two pre-existing TypeScript files: linkedin.ts and social-urls.test.ts. The exact HEAD^..HEAD diff has no added files and no added .js, .jsx, .cjs, or .mjs source fil…
Full details: Type-Safe Boundaries

Explanation

The PR changes only the typed LinkedIn UsernameRule configuration and assigns the new rule to company/ and school/ path types. The shared validator still compiles and checks the username before building or storing a URL. The changed production code adds no boundary read, any, unchecked as, @ts-nocheck, @ts-ignore, or duplicate schema type. The added tests are exempt by the check.

Full details: New Files Are Typescript

Explanation

The PR changes only two pre-existing TypeScript files: linkedin.ts and social-urls.test.ts. The exact HEAD^..HEAD diff has no added files and no added .js, .jsx, .cjs, or .mjs source file.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-underscores-in-linkedin-urls

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

@nx-cloud

nx-cloud Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit f945e6f

Command Status Duration Result
nx run @tryghost/admin:test:acceptance ✅ Succeeded 8m 10s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-03 09:51:50 UTC

@louisghost
louisghost merged commit 2b1c9ab into main Sep 3, 2026
94 of 96 checks passed
@louisghost
louisghost deleted the fix-underscores-in-linkedin-urls branch September 3, 2026 10:01
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