8000 feat(notes): keep a page's images and attachments where Settings → Storage says by adeelahmad · Pull Request #150 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(notes): keep a page's images and attachments where Settings → Storage says - #150

Merged
adeelahmad merged 1 commit into
mainfrom
claude/notes-module-j9j30y
Oct 5, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/notes-module-j9j30y

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Before: images or files pasted into a note lived only in the browser tab and were gone after a reload.

After: pasted or dropped images and attachments are kept on the server, in the file store from #148. That is this machine, or the storage connection chosen in Settings → Storage (#149), and each file is encrypted with its namespace's key before it leaves the machine. A reload brings the images back.

Serving rules:

  • Anyone who can read the page can read its files.
  • Images and PDFs show in place; HTML and SVG are only downloaded (nosniff, sandbox CSP).
  • Deleting a page deletes its files.

When the assistant reads a note, it now sees the note's files.

How:

  • Editor: BlockSuite's blob source (blobSources.main in block-editor.tsx) holds files while the page is open and keeps them through PUT/GET /api/v1/notes/{id}/blobs?key=…. For a page that doesn't exist yet, uploads wait until its first save.
  • Keys: the server checks that the key is the bytes' SHA-256 in base64url, which is what BlockSuite uses. The same file is kept once per page.
  • Storage rows: the note_file table, added through store.SCHEMA.
  • Other routes: GET /notes/{id}/files lists a page's files, and DELETE /notes/{id}/files?key= removes one.
  • Errors: a locked vault answers 423, and an unreachable storage connection answers 502.
  • Checks:
    • Backend: test_page_files covers the round trip, dedupe, the hash check, roles, safe serving and deletion. The full backend suite passes (637). The one test left out, besides the LibreOffice conversion test, is test_sources_and_watched_folders, which fails the same way on main in this container.
    • Frontend: tsc and eslint pass.
    • In a real browser on a local stack, a pasted PNG is PUT (200) and kept. After a reload it is read back with GET (200) and drawn.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XZQXJtCvJgbG1Z2H312KcS


Generated by Claude Code

…orage says

The note editor's blob source keeps images and files dropped or pasted into a
page on the server (note_file), in the file store: encrypted before they leave
the machine. Keys are the bytes' SHA-256 (checked), so a file is kept once per
page. Images and PDFs show in place; HTML and SVG only download. Deleting a page
deletes its files; the assistant sees a page's files when it reads it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XZQXJtCvJgbG1Z2H312KcS
@adeelahmad
adeelahmad merged commit 310b80b into main Oct 5, 2026
0 of 5 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.

2 participants

0