Fix NewUserWebDAVClient to strip path from base URL before constructing user-specific WebDAV URL
This commit is contained in:
BIN
go_cloud/api
BIN
go_cloud/api
Binary file not shown.
@@ -65,10 +65,13 @@ func GenerateSecurePassword(length int) (string, error) {
|
|||||||
|
|
||||||
// NewUserWebDAVClient creates a WebDAV client for a specific user
|
// NewUserWebDAVClient creates a WebDAV client for a specific user
|
||||||
func NewUserWebDAVClient(nextcloudBaseURL, username, password string) *WebDAVClient {
|
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{
|
return &WebDAVClient{
|
||||||
baseURL: baseURL,
|
baseURL: fullURL,
|
||||||
user: username,
|
user: username,
|
||||||
pass: password,
|
pass: password,
|
||||||
basePrefix: "/",
|
basePrefix: "/",
|
||||||
|
|||||||
Reference in New Issue
Block a user