Repository navigation
fix(inbox): open relative Markdown links in attachments - #2363
Merged
backnotprop merged 7 commits intoOct 31, 2026
Merged
backnotprop merged 7 commits into
backnotprop merged 7 commits into
Conversation
# Conflicts: # packages/inbox/components/AttachmentPane.tsx
…under a linked doc, e2e - LinkedMarkdown reads its images through the attachment's markdown-image route via inboxMarkdownImageBase(..., document), so the URL goes through inboxUrl (linked machines; tests/inbox-url-helper.test.ts). - The attached file's Contents rail and button hide while a linked document covers it. - A fragment on an attached Markdown file scrolls once the file is drawn. - e2e: a relative .md link opens the linked doc; nested, out-of-folder, hidden, fragment, reload and Back.
… remembered scroll is its own Review follow-ups: key LinkedMarkdown per stack entry as HtmlViewer is, and scrollerOf skips the linked document's scroller.
…ecked by where it leads - AttachmentPane and LinkedMarkdown pass a stable resolveLocalLink (and onOpenLink), so ui's HtmlBlock no longer redraws raw HTML blocks on every pane render. DOM test markdownLinks.test.tsx guards both documents. - readInboxLinkedPage checks the realpath's extension too: alias.md leading to data.json is refused (415), for /linked-page and markdown-image. - A Markdown file's refusal note no longer says images open from a link. - server-and-storage.md: the markdown-image row keeps main's text first; document= ignores version.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Relative Markdown links in Inbox attachments currently navigate to the server root instead of opening the linked file.
This change routes
.mdand.mdxlinks through the existing linked-document viewer. Links resolve relative to the current document, and unattached documents open read-only within the original attachment's folder. Nested links, fragments, Back, Escape and reload keep the thread open.The server retains folder containment, hidden-file refusals, symlink checks, the 2 MB document limit and cross-origin guards. Images in linked Markdown resolve from that document's directory and must be referenced in its content. Existing HTML navigation remains unchanged.
Closes #2230.
Verification
bun test ./packages/server/inbox-attachments.test.ts ./packages/server/inbox-linked-page.test.ts ./packages/inbox/htmlLinks.test.tsDOM_TESTS=1 bun test ./packages/inbox/htmlLinks.test.tsxbun test ./packages/server/inbox-tailscale.test.tsbunx tsc --noEmit -p packages/inbox/tsconfig.jsonbunx tsc --noEmit -p packages/server/tsconfig.jsonbun run --cwd apps/inbox buildDocs
Updated the Inbox document-navigation guide and attachment API documentation.
Maintainer follow-up
Thanks @utpalsinghdev for this fix. Your commit is kept as you wrote it. On top of it:
mainin. There was one conflict, inAttachmentPane.tsx: the Contents gutter attribute from main and yourib-covered/inertsit on the same element now.markdown-imageresolver (inboxMarkdownImageBase(id, version, document)), so the URL is written byinboxUrllike every other Inbox URL (tests/inbox-url-helper.test.ts).<details>closed).packages/inbox/markdownLinks.test.tsxguards this for the attached file and for a linked document.alias.mdthat leads todata.jsonis refused (415), for/linked-pageand formarkdown-image?document=.tests/e2e/inbox-markdown-links.spec.ts. It covers:Not covered: linked machines and paired phones.
/linked-pageandmarkdown-imageare not on the device door, as onmain, so a relative Markdown link opens only for a thread on this machine, in the window. The message of commit c52ff4d says "(linked machines)". That is about how the URL is written, not about the feature working there.