Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Slack integration: links on self-hosted domains never unfurl (parseCapShareUrl only accepts cap.so / cap.link)

Geschlossen Anfängerfreundlich
#2,546 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Ein zugehöriger Pull Request wurde bereits gemerged.

  • #1 von @mangeshraut712 — ohne Merge geschlossen
  • #2549 von @mangeshraut712 — gemerged
  • #2574 von @dangzhuotong — ohne Merge geschlossen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
72/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
nextjs, typescript
Bereich
api, backend

Rechercherichtung

Beginne mit parseCapShareUrl in apps/web/lib/oembed.ts, das sowohl von processSlackEvent als auch von /api/oembed aufgerufen wird, und prüfe, wie serverEnv().WEB_URL an anderen Stellen in apps/web bereits gelesen wird. Bestätige, dass ein /s/<id>-Link auf einem Host, der nicht cap.so ist, heute null zurückgibt. Fertig ist es, wenn ein Share-Link auf dem konfigurierten WEB_URL-Host in beiden Pfaden zu einer Video-ID aufgelöst wird und Links auf anderen Hosts weiterhin null zurückgeben.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug
Description

On a self-hosted Cap server, the Slack integration never shows a preview or inline player for share links on the server's own domain.

The Slack app installs and connects fine, Slack sends link_shared events, and /api/integrations/slack/events returns 200, but Cap never calls chat.unfurl. Nothing is logged, so it fails silently.

Expected: a public link like https://video.example.com/s/<id> unfurls in Slack with the title, thumbnail and inline player, the same as cap.so links.

Actual: Slack shows a plain link. Because the app claims the domain, Slack also skips its own Open Graph preview, so it's worse than having no app installed.

Cause: processSlackEvent passes each link through parseCapShareUrl (apps/web/lib/oembed.ts), which only accepts Cap's hosted domains:

if (hostname === "cap.so" && segments.length === 2 && segments[0] === "s") {
  videoId = segments[1];
}
if (hostname === "cap.link" && segments.length === 1 && segments[0] !== "video") {
  videoId = segments[0];
}

For any other host it returns null, so the link is dropped before the video is looked up. /api/oembed uses the same function, so it returns 400 for the server's own links, even though the share page advertises that oEmbed URL.

Suggested fix: also accept the host of WEB_URL with the /s/<id> path:

const webHost = new URL(serverEnv().WEB_URL).hostname.toLowerCase().replace(/^www\./, "");

if ((hostname === "cap.so" || hostname === webHost) && segments.length === 2 && segments[0] === "s") {
  videoId = segments[1];
}

This fixes both Slack unfurls and /api/oembed on self-hosted servers.

Reproduction
  1. Run Cap self-hosted with WEB_URL=https://video.example.com (official cap-web Docker image).
  2. Create a Slack app from apps/web/slack-app-manifest.json, replacing cap.so with video.example.com in the unfurl domain, redirect URL and event URL.
  3. Set SLACK_CLIENT_ID, SLACK_CLIENT_SECRET and SLACK_SIGNING_SECRET, restart cap-web, and verify the event URL in Slack (it verifies).
  4. In Cap: Organization Settings → Integrations → Slack → Connect (it connects).
  5. Use a public video with no password; the organization has no access email domain.
  6. Paste https://video.example.com/s/<id> in a Slack channel.
  7. No preview appears. The server receives the Slack event (200), and Slack never loads /embed/<id>.

Quick check without Slack:

curl -s -o /dev/null -w "%{http_code}\n" \
  "https://video.example.com/api/oembed?url=https%3A%2F%2Fvideo.example.com%2Fs%2F<id>&format=json"
# returns 400 (expected 200 with oEmbed JSON)
Additional Context
  • Cap version: official ghcr.io/capsoftware/cap-web Docker image built 2026-09-07 (arm64 sha256:5b65d137f7f7ddd767e1acb37380a4609f43287458410515a013157b56cfa83d). The same parseCapShareUrl code is on main today.
  • Operating system, version: server is Linux arm64 (AWS ECS Fargate), self-hosted with Aurora MySQL and S3, NEXT_PUBLIC_IS_CAP not set. Slack desktop app on macOS.
  • Device (optional): n/a (server-side issue)
  • Related: #2058 (Slack integration), #2122 / #2123 (share metadata on custom domains). Those fixed the Open Graph tags; this is the separate Slack-app path.
Vorherrschende Sprache
Rust
Sterne
23.2k
Forks
2k
Ø Merge
1 T. 6 Std.
Gemergte PRs (30 T.)
127

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus CapSoftware/Cap

Alle Issues in CapSoftware/Cap

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.