Skip to content

Add Webdav server - #44

Merged
HanXHX merged 7 commits into
masterfrom
webdav
Jul 6, 2026
Merged

Add Webdav server#44
HanXHX merged 7 commits into
masterfrom
webdav

Conversation

@HanXHX

@HanXHX HanXHX commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings June 7, 2026 11:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a local WebDAV server command that exposes RETYC datarooms as a mountable filesystem, and extends the service layer to support WebDAV-oriented streaming uploads/downloads and richer node metadata.

Changes:

  • Add retyc webdav serve command with a WebDAV filesystem implementation, caching, and streaming upload/download behavior.
  • Extend dataroom listing/session APIs to expose MIME type + version/chunk metadata and allow reusing resolved crypto sessions.
  • Refactor chunk transfer utilities to support io.Reader uploads and streaming (io.Writer) downloads, with expanded tests.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/service/types.go Extends DataroomNodeInfo with MIME type and version/chunk metadata for WebDAV usage.
internal/service/dataroom.go Exposes reusable dataroom crypto session, factors listing logic, and adds stream-upload initialization helper.
internal/service/chunks.go Changes upload to io.Reader, adds StreamDownloadChunks with bounded buffering, refactors file download to use streaming.
internal/service/chunks_test.go Adds tests for reader-based uploads and streaming download ordering/error/edge cases.
cmd/webdav.go Adds the WebDAV server command and filesystem implementation (listing, stat, read/seek, write, mkdir/rm/rename).
cmd/webdav_test.go Adds unit tests for key WebDAV helpers (path parsing, caching, stream write handle).
go.mod Adds golang.org/x/net (WebDAV) and bumps several x/* dependencies.
go.sum Updates sums for the new/updated x/* module versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 145 to +152
concurrency := DownloadConcurrency
if chunkCount < concurrency {
concurrency = chunkCount
}
if concurrency < 1 {
// Nothing to download (empty file, or a malformed negative chunkCount).
return nil
}
Comment thread cmd/webdav.go Outdated
Comment on lines +429 to +437
// A zero-byte buffered write is almost always a WebDAV LOCK creating a
// lock-null resource (macOS Finder, MS Office) rather than a real upload.
// Genuine empty-file PUTs carry Content-Length: 0 and take the streaming path,
// so skipping the upload here avoids creating a phantom empty node.
if fi, statErr := os.Stat(h.tempFilePath); statErr == nil && fi.Size() == 0 {
_ = os.RemoveAll(h.tempDir)

return nil
}
Comment thread cmd/webdav.go
Comment on lines +1068 to +1073
var shutdownOnce sync.Once
shutdown := func() {
shutdownOnce.Do(func() {
cancel()
_ = srv.Shutdown(context.Background())
})
HanXHX added 4 commits June 12, 2026 15:32
Required by the WebDAV server + bumps the
transitively-pulled x/sys, x/term, x/crypto, and x/text.
- UploadChunks / StreamDownloadChunks operate on io.Reader / io.Writer
  with bounded-memory concurrent transfer (windowed reorder buffer,
  empty/negative chunk-count guard).
- Per-dataroom session, listing, and streaming-upload helpers
  (GetDataroomSession, ListNodesWithSession, InitStreamUpload), with
  ListNodes de-duplicated onto shared fetch/decrypt helpers and path
  errors wrapped as os.ErrNotExist.
- DataroomNodeInfo carries the decrypted MIME type, version ID, and
  chunk count needed for direct downloads.
@HanXHX
HanXHX merged commit 92fe308 into master Jul 6, 2026
1 check 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