feat: implement unified directory structure with automatic migration for CalDAV and CardDAV
- Unify directory structure across all protocols under user directory: * WebDAV: data/<username>/files/ * CalDAV: data/<username>/calendars/<name>/ * CardDAV: data/<username>/addressbooks/<name>/ - Add automatic migration capability that runs on server startup - Maintain full backward compatibility with existing installations - Improve Docker usage by automatically handling legacy data structure - Updated storage provider implementations to use new nested structure - Enhanced store functions for backward compatibility - Modified CalDAV and CardDAV backends to use unified paths - Added automatic migration logic in server initialization - Changed WebDAV path from data/files/<username>/ to data/<username>/files/
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
// NewHandler returns an http.Handler that provides standard WebDAV file access,
|
// NewHandler returns an http.Handler that provides standard WebDAV file access,
|
||||||
// mounted at the fixed URL /files/ for every user and rooted at
|
// mounted at the fixed URL /files/ for every user and rooted at
|
||||||
// dataDir/files/<username>/ on disk. The URL is the same for all users —
|
// dataDir/<username>/files/ on disk. The URL is the same for all users —
|
||||||
// which user's directory is served is resolved from the Basic Auth identity
|
// which user's directory is served is resolved from the Basic Auth identity
|
||||||
// in the request context, not from the URL.
|
// in the request context, not from the URL.
|
||||||
//
|
//
|
||||||
@@ -38,7 +38,7 @@ func NewHandler(cfg *config.Config, dataDir string, logger *slog.Logger) http.Ha
|
|||||||
h, ok := handlers[p.Username]
|
h, ok := handlers[p.Username]
|
||||||
if !ok {
|
if !ok {
|
||||||
username := p.Username
|
username := p.Username
|
||||||
userDir := filepath.Join(dataDir, "files", username)
|
userDir := filepath.Join(dataDir, username, "files")
|
||||||
if err := os.MkdirAll(userDir, 0o755); err != nil {
|
if err := os.MkdirAll(userDir, 0o755); err != nil {
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
logger.Error("creating user WebDAV dir", "user", username, "error", err)
|
logger.Error("creating user WebDAV dir", "user", username, "error", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user