Skip to content

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

Open
jonhickman wants to merge 1 commit into
TryGhost:mainfrom
jonhickman:fix/linkedin-company-underscore-validation
Open

🐛 Fixed LinkedIn company and school URLs with underscores being rejected as invalid#28893
jonhickman wants to merge 1 commit into
TryGhost:mainfrom
jonhickman:fix/linkedin-company-underscore-validation

Conversation

@jonhickman

Copy link
Copy Markdown
Contributor

Problem

LinkedIn company and school page URLs can contain underscores — e.g. https://www.linkedin.com/company/eyeshot_2 — but the front-end validator only permitted alphanumeric characters and hyphens, causing these valid URLs to be incorrectly rejected.

Solution

Add a separate regex for company and school path types that permits underscores in addition to alphanumeric characters and hyphens. The stricter rule (no underscores) is preserved for personal /in/ profiles, which follow LinkedIn's documented format of alphanumeric and hyphen only.

Testing

New unit tests added covering:

  • company and school URLs with underscores are accepted
  • Personal /in/ URLs with underscores continue to be rejected

All 179 unit tests pass.

…ted as invalid

LinkedIn company and school page URLs can contain underscores (e.g. /company/eyeshot_2),
but the validator only allowed alphanumeric characters and hyphens, causing valid URLs to
be incorrectly rejected. Personal /in/ profile URLs do not allow underscores per LinkedIn's
own documentation, so the stricter rule is preserved for those.
@jonhickman jonhickman requested a review from 9larsons June 25, 2026 06:42
@coderabbitai

coderabbitai Bot commented Jun 25, 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: CHILL

Plan: Pro

Run ID: 3666d38b-257a-4a9e-a5e1-63fe8f70a01f

📥 Commits

Reviewing files that changed from the base of the PR and between 0888b43 and 0c7f9cc.

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

Walkthrough

LinkedIn URL validation now uses path-specific username rules: pub keeps its existing pattern, company and school allow underscores, and in continues to reject them. The unit tests were extended to cover underscore acceptance for company and school URLs and rejection for personal URLs.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: allowing LinkedIn company and school URLs with underscores.
Description check ✅ Passed The description is directly related to the code changes and test updates in the pull request.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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.

@nx-cloud

nx-cloud Bot commented Jun 25, 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 0c7f9cc

Command Status Duration Result
nx run @tryghost/admin-x-settings:test:acceptance ✅ Succeeded 9m 41s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded 3s View ↗
nx run-many -t test:unit -p @tryghost/admin-x-s... ✅ Succeeded 2m 16s View ↗
nx run @tryghost/admin:build ✅ Succeeded 1m 43s View ↗
nx run-many -t lint -p @tryghost/admin-x-settin... ✅ Succeeded 19s View ↗
nx run ghost:build:assets ✅ Succeeded 2s View ↗
nx run ghost:build:tsc ✅ Succeeded 6s View ↗

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


☁️ Nx Cloud last updated this comment at 2026-06-25 06:54:15 UTC

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.

1 participant