Repository navigation
feat(smb): import files added over the SMB share - #519
Merged
Merged
Conversation
A file copied into the SMB share is written to the uploads disk while it's open and imported when it's closed (share_import.Adder.begin and finish), with the same permission and checks as an upload. MKCOL-style folder creates under Collections make collections; renaming a file kept aside imports it; deleting one removes it. Files of a type Lens doesn't take are refused at create, files over the upload limit are cut off as they're written and dropped, and files deleted on close or left open when the connection ends are never imported. smb.add_files (on) makes the share writable; off, it's read-only as before. Adder.check now checks a file's type even before its size is known (S3 multipart, chunked WebDAV, SMB creates). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013sC1p4dJXjteytbxDXnk5g
…-cmjahx # Conflicts: # threat-model.yaml
…-cmjahx # Conflicts: # CHANGELOG.md # threat-model.yaml
…-cmjahx # Conflicts: # CHANGELOG.md # README.md # threat-model.yaml
…-cmjahx # Conflicts: # threat-model.yaml
…-cmjahx # Conflicts: # threat-model.yaml
…-cmjahx # Conflicts: # CHANGELOG.md
This was referenced Oct 18, 2026
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.
Requested by Adeel · project thread
Description
Before: the SMB share was read-only. Copying a file onto it from Finder, Windows Explorer or
smbclientwas refused.After: a file copied into a collection's folder on the SMB share is imported when it's closed, as a web upload is. A new folder under
Collectionsis a new collection, and a file anywhere else in a namespace goes to its default collection.How: SMB creates, writes, renames and closes go to the same
share_import.Adderthat S3 and WebDAV use (#408). The file is written to the uploads disk while it's open and handed touploads.take()on close, so it gets the upload's permission, type and size checks, the namespace's pipeline and dedupe. Files of a type Lens doesn't take are refused when they're created. Files over the upload limit are cut off as they're written and dropped. Files deleted on close, or left open when the client goes away, are never imported. The system's own files (.DS_Store,Thumbs.db, Office's~$files) are kept aside, and renaming a temporary file to a real name imports it.Adder.checknow checks a file's type before its size is known, which also helps S3 multipart and chunked WebDAV.Motivation and Context
Adeel asked that any file added through Lens's file protocols be imported automatically. #408 did S3 and WebDAV; this does SMB, and NFS follows.
Steps to reproduce (if appropriate):
Turn on the SMB share, then
smbclient //host/lens -p 1445 -U <key-id>%<secret> -c 'cd pods/Collections/Talks; put talk.pdf'and look at the Talks collection.Types of changes
!in the title)Checklist:
make hookschecks it on commit).tests/domain/test_smb_writes.py(6),test_smb_share.pyupdated.ci/local-ci.sh: backend, Next.js, pre-commit and the upgrade check pass.docs/accordingly (docs/smb.md, Adding files;docs/file-tree.md).## UnreleasedinCHANGELOG.md.Done questions (AGENTS.md)
smbclient, impacket) adds files;smb.add_filesis in the settings API.smb.add_files(on) is a switch in Settings, SMB share; not in the wizard.docs/requirements.mdname the tests. Tested with impacket's client and Samba'ssmbclient, not with Finder or Explorer themselves.make openapiregeneratedopenapi.jsonand the client.share_importadder from feat(shares): import files added over S3 and WebDAV #408.Generated by Claude Code