diff --git a/go_cloud/internal/storage/nextcloud.go b/go_cloud/internal/storage/nextcloud.go index 34dedaa..89928c6 100644 --- a/go_cloud/internal/storage/nextcloud.go +++ b/go_cloud/internal/storage/nextcloud.go @@ -17,7 +17,7 @@ func CreateNextcloudUser(nextcloudBaseURL, adminUser, adminPass, username, passw url := fmt.Sprintf("%s/ocs/v1.php/cloud/users", baseURL) // OCS API expects form-encoded data, not JSON - formData := fmt.Sprintf("userid=%s&password=%s", + formData := fmt.Sprintf("userid=%s&password=%s", strings.ReplaceAll(username, " ", "+"), strings.ReplaceAll(password, " ", "+")) @@ -63,7 +63,7 @@ func NewUserWebDAVClient(nextcloudBaseURL, username, password string) *WebDAVCli 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) - + fmt.Printf("[WEBDAV-USER] Input URL: %s, Base: %s, Full: %s, User: %s\n", nextcloudBaseURL, baseURL, fullURL, username) return &WebDAVClient{ diff --git a/go_cloud/internal/storage/webdav.go b/go_cloud/internal/storage/webdav.go index 39801e0..ad69773 100644 --- a/go_cloud/internal/storage/webdav.go +++ b/go_cloud/internal/storage/webdav.go @@ -88,7 +88,7 @@ func (c *WebDAVClient) Upload(ctx context.Context, remotePath string, r io.Reade u = "" } u = strings.TrimRight(u, "/") - + var full string if u == "" { full = fmt.Sprintf("%s/%s", c.baseURL, url.PathEscape(rel)) @@ -96,7 +96,7 @@ func (c *WebDAVClient) Upload(ctx context.Context, remotePath string, r io.Reade full = fmt.Sprintf("%s%s/%s", c.baseURL, u, url.PathEscape(rel)) } full = strings.ReplaceAll(full, "%2F", "/") - + fmt.Printf("[WEBDAV-UPLOAD] BaseURL: %s, BasePrefix: %s, RemotePath: %s, Full URL: %s\n", c.baseURL, c.basePrefix, remotePath, full) req, err := http.NewRequestWithContext(ctx, "PUT", full, r) @@ -135,7 +135,7 @@ func (c *WebDAVClient) Download(ctx context.Context, remotePath string) (io.Read u = "" } u = strings.TrimRight(u, "/") - + var full string if u == "" { full = fmt.Sprintf("%s/%s", c.baseURL, url.PathEscape(rel)) @@ -178,7 +178,7 @@ func (c *WebDAVClient) Delete(ctx context.Context, remotePath string) error { u = "" } u = strings.TrimRight(u, "/") - + var full string if u == "" { full = fmt.Sprintf("%s/%s", c.baseURL, url.PathEscape(rel))