Skip to content

Fix social URL host matching - #1174

Merged
MaheshtheDev merged 2 commits into
supermemoryai:mainfrom
anirudh5harma:codex/1173-social-url-substring-detection
Jun 28, 2026
Merged

Fix social URL host matching#1174
MaheshtheDev merged 2 commits into
supermemoryai:mainfrom
anirudh5harma:codex/1173-social-url-substring-detection

Conversation

@anirudh5harma

@anirudh5harma anirudh5harma commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Parse social links as URLs before classifying Twitter/X and LinkedIn profile URLs
  • Match social domains by hostname instead of substring search
  • Add regression tests for spoofed LinkedIn paths and non-Twitter domains containing x.com/twitter.com text

Closes #1173

Tests

  • bun test apps/web/lib/url-helpers.test.ts
  • bun test apps/web/lib/*.test.ts
  • bunx biome check apps/web/lib/url-helpers.ts apps/web/lib/url-helpers.test.ts
  • bunx turbo run check-types --filter='@supermemory/ai-sdk' --filter='@supermemory/memory-graph'

Session Details

@vorflux

vorflux Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Vorflux skipped this auto review because this account has reached its Auto Review daily review limit (20/20). You can change this in Auto Review Settings: https://us1.vorflux.com/supermemory/settings?section=pull-requests

@vorflux vorflux Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same review finding from the superseded PR still applies here.


Review with Vorflux

Comment thread apps/web/lib/url-helpers.ts
@anirudh5harma
anirudh5harma force-pushed the codex/1173-social-url-substring-detection branch from 1b3d1ca to 7e37463 Compare June 27, 2026 21:31
@vorflux

vorflux Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Verified the update: the uppercase HTTP:// / HTTPS:// regression is fixed and the new collectValidUrls regression cases pass.

Checks run:

  • npx --yes bun@1.3.6 test apps/web/lib/url-helpers.test.ts passed
  • npx --yes bun@1.3.6 test apps/web/lib/*.test.ts passed
  • npx --yes bun@1.3.6 x biome check apps/web/lib/url-helpers.ts apps/web/lib/url-helpers.test.ts passed
  • Typecheck command still fails on the pre-existing/local @supermemory/memory-graph missing vitest type declarations, unrelated to this diff.

@vorflux vorflux Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Validated this PR. I think it is needed: main currently classifies URLs by substring, so a normal webpage like https://notx.com/profile is treated as Twitter in the document modal before the webpage branch runs. This patch fixes that by parsing the URL and matching the hostname/path instead.

No blockers found. Focused tests pass, all apps/web/lib tests pass, and Biome passes on the touched files. Typecheck still fails on the existing @supermemory/memory-graph missing vitest declarations, which is unrelated to this diff.


Review with Vorflux

@MaheshtheDev MaheshtheDev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@MaheshtheDev
MaheshtheDev removed the request for review from Dhravya June 28, 2026 01:55
@MaheshtheDev
MaheshtheDev enabled auto-merge (squash) June 28, 2026 01:55
@anirudh5harma

Copy link
Copy Markdown
Contributor Author

@MaheshtheDev this needs someone for another review

@MaheshtheDev MaheshtheDev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Re-reviewed the latest head after the test file removal and verified the URL helper behavior manually.

Checks run:

  • npx --yes bun@1.3.6 test apps/web/lib/*.test.ts passed
  • npx --yes bun@1.3.6 x biome check apps/web/lib/url-helpers.ts passed
  • Manual Bun check confirms uppercase HTTP/HTTPS Twitter links are filtered, notx.com is kept, spoofed LinkedIn paths are rejected, and LinkedIn company pages are rejected
  • Typecheck still fails only on the existing @supermemory/memory-graph missing vitest type declarations, unrelated to this diff

@MaheshtheDev
MaheshtheDev merged commit 5d975eb into supermemoryai:main Jun 28, 2026
3 checks passed
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.

Social URL detection matches domains by substring

3 participants