From a485411e103b610b166a50602c22b181097d508f Mon Sep 17 00:00:00 2001 From: Cinerar Date: Mon, 15 Jun 2020 09:14:04 +0300 Subject: [PATCH 1/3] fix backslash character as path separator when run on windows --- cloud.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cloud.go b/cloud.go index 817f469..58a40ef 100644 --- a/cloud.go +++ b/cloud.go @@ -158,8 +158,7 @@ func (c *Client) CreateReadOnlyShare(path string) (*ShareResult, error) { func (c *Client) sendWebDavRequest(request string, path string, data []byte) ([]byte, error) { // Create the https request - webdavPath := filepath.Join("remote.php/webdav", path) - + webdavPath := filepath.ToSlash(filepath.Join("remote.php/webdav", path)) folderUrl, err := url.Parse(webdavPath) if err != nil { return nil, err From 567e7ffaa50f497797926a70c1a8e1fc7dcf609c Mon Sep 17 00:00:00 2001 From: Cinerar Date: Mon, 15 Jun 2020 09:14:49 +0300 Subject: [PATCH 2/3] fix all filepath.join when run on windows --- cloud.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cloud.go b/cloud.go index 58a40ef..7ab6d5c 100644 --- a/cloud.go +++ b/cloud.go @@ -94,7 +94,7 @@ func (c *Client) UploadDir(src string, dest string) ([]string, error) { if err != nil { return nil, err } - err = c.Upload(data, filepath.Join(dest, filepath.Base(file))) + err = c.Upload(data, filepath.ToSlash(filepath.Join(dest, filepath.Base(file)))) if err != nil { return nil, err } @@ -202,7 +202,7 @@ func (c *Client) sendWebDavRequest(request string, path string, data []byte) ([] func (c *Client) sendAppsRequest(request string, path string, data string) (*ShareResult, error) { // Create the https request - appsPath := filepath.Join("apps", path) + appsPath := filepath.ToSlash(filepath.Join("apps", path)) folderUrl, err := url.Parse(appsPath) if err != nil { @@ -245,7 +245,7 @@ func (c *Client) sendAppsRequest(request string, path string, data string) (*Sha func (c *Client) sendOCSRequest(request string, path string, data string) (*ShareResult, error) { // Create the https request - appsPath := filepath.Join("ocs/v2.php/apps/files_sharing/api/v1", path) + appsPath := filepath.ToSlash(filepath.Join("ocs/v2.php/apps/files_sharing/api/v1", path)) folderUrl, err := url.Parse(appsPath) if err != nil { From d65f6aff420148a7e8a5b7d6f9a3e539554a500b Mon Sep 17 00:00:00 2001 From: Cinerar Date: Mon, 15 Jun 2020 10:32:10 +0300 Subject: [PATCH 3/3] CreateReadOnlyShare --- cloud.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud.go b/cloud.go index 7ab6d5c..3359f5f 100644 --- a/cloud.go +++ b/cloud.go @@ -147,7 +147,7 @@ func (c *Client) CreateFileDropShare(path string) (*ShareResult, error) { } func (c *Client) CreateReadOnlyShare(path string) (*ShareResult, error) { - result, err := c.CreateShare(path, 3, "true", 4) + result, err := c.CreateShare(path, 3, "false", 4) if err != nil { return nil, err }