Repository navigation
Conversation
When a user shares a file or image in Nextcloud Talk, the webhook
delivers object.content as a JSON-encoded rich object message like:
{"message":"{file}","parameters":{"file":{"type":"file","name":"IMG.jpg","link":"https://..."}}}
Previously payloadToInboundMessage() passed this raw JSON string as
text, leaving mediaUrls unpopulated and the agent blind to attachments.
This change adds parseRichObjectContent() which:
- Detects JSON-encoded rich object payloads
- Extracts file links into mediaUrls
- Resolves {placeholder} names for human-readable displayText
- Falls back to raw content for non-rich-object text (no behaviour change)
Also updates NextcloudTalkInboundMessage type to include mediaUrls?,
passes mediaUrls through inbound.ts to the agent context payload, and
relaxes the empty-body guard to allow media-only messages through.
Fixes #29152
Greptile SummaryThis PR fixes NC Talk file share parsing by adding a Key findings:
Confidence Score: 3/5
|
| "x-nextcloud-talk-backend": "https://nextcloud.example", | ||
| }, | ||
| }; | ||
| } |
There was a problem hiding this comment.
Personal Tailscale hostname in committed tests
The integration tests hardcode vivokrei-ubuntu.tailfc1e89.ts.net, which is a personal developer Tailscale device hostname. Even though these tests only assert against the parsed URL string (no real HTTP call is made to that host), shipping a personal infrastructure address in the repository is not ideal — it will show up in grep/search results, may confuse future contributors, and the hostname could eventually become stale or be repurposed.
Consider replacing with a generic example domain like cloud.example.com:
| } | |
| "x-nextcloud-talk-backend": "https://cloud.example.com", |
The same applies to every occurrence of vivokrei-ubuntu.tailfc1e89.ts.net across this file (lines 45, 96, 116, 132, 144).
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/nextcloud-talk/src/monitor.live-integration.test.ts
Line: 37
Comment:
**Personal Tailscale hostname in committed tests**
The integration tests hardcode `vivokrei-ubuntu.tailfc1e89.ts.net`, which is a personal developer Tailscale device hostname. Even though these tests only assert against the *parsed* URL string (no real HTTP call is made to that host), shipping a personal infrastructure address in the repository is not ideal — it will show up in grep/search results, may confuse future contributors, and the hostname could eventually become stale or be repurposed.
Consider replacing with a generic example domain like `cloud.example.com`:
```suggestion
"x-nextcloud-talk-backend": "https://cloud.example.com",
```
The same applies to every occurrence of `vivokrei-ubuntu.tailfc1e89.ts.net` across this file (lines 45, 96, 116, 132, 144).
How can I resolve this? If you propose a fix, please make it concise.|
Closing to re-submit from a clean fork (housekeeping). |
Summary
Fixes #29152
When a user shares a file or image in Nextcloud Talk, the bot webhook receives the message but the NC Talk plugin was not parsing the rich object parameters — so the agent never saw the attachment.
NC Talk encodes file shares as rich object messages where
object.contentis a JSON string:{"message":"{file}","parameters":{"file":{"type":"file","id":"12345","name":"IMG_123.jpg","path":"Talk/IMG_123.jpg","link":"https://cloud.example.com/f/12345","mimetype":"image/jpeg","preview-available":"yes"}}}Previously
payloadToInboundMessage()passed this raw JSON string astext, leavingmediaUrlsunpopulated.Changes
monitor.tsparseRichObjectContent()helper that detects JSON-encoded rich object payloadsmediaUrls(https/http only — rejectsfile://,javascript:, etc.){placeholder}names for human-readabledisplayText(covers file shares, mentions, deck cards, polls, etc.)replaceAllfor placeholder substitution to handle duplicate occurrencescontentfor non-rich-object text — no behaviour change for regular messagestypes.tsmediaUrls?: string[]toNextcloudTalkInboundMessageinbound.tsMediaUrlsintofinalizeInboundContextso the agent receives them (verified:finalizeInboundContextalready consumesMediaUrls: string[]natively)Tests
monitor.attachment.test.ts— 7 unit tests: file share, text passthrough, malformed JSON fallback, name fallback, mention resolution,file://URL rejection, multi-filemonitor.live-integration.test.ts— 5 integration tests using real HMAC-signed payloads against the webhook serverAll 12 tests pass. TypeScript compiles clean (
tsc --noEmit).Before / After
Before: Sharing a file in NC Talk → agent receives raw JSON string, never sees the attachment.
After: Sharing a file → agent receives
text = "filename.jpg"and `mediaUrls = ["https://..."]" — can immediately process the image via vision without any manual workaround.