Fix NewUserWebDAVClient to strip path from base URL before constructing user-specific WebDAV URL

This commit is contained in:
Leon Bösche
2026-01-10 23:24:24 +01:00
parent 4a4e03e041
commit 0ce9185373
2 changed files with 5 additions and 2 deletions

Binary file not shown.

View File

@@ -65,10 +65,13 @@ func GenerateSecurePassword(length int) (string, error) {
// NewUserWebDAVClient creates a WebDAV client for a specific user
func NewUserWebDAVClient(nextcloudBaseURL, username, password string) *WebDAVClient {
baseURL := fmt.Sprintf("%s/remote.php/dav/files/%s", nextcloudBaseURL, username)
// Remove any path from base URL, we need just the scheme://host:port
baseURL := strings.Split(nextcloudBaseURL, "/remote.php")[0]
// Build the full WebDAV URL for this user
fullURL := fmt.Sprintf("%s/remote.php/dav/files/%s", baseURL, username)
return &WebDAVClient{
baseURL: baseURL,
baseURL: fullURL,
user: username,
pass: password,
basePrefix: "/",