From 4d18e71591e6eafb616335fa870175a900a4e0d5 Mon Sep 17 00:00:00 2001 From: l3uddz Date: Mon, 20 Apr 2020 22:25:21 +0100 Subject: [PATCH] change(rclone): dont format parameters --- rclone/helpers.go | 31 ------------------------------- syncer/copy.go | 2 +- syncer/dedupe.go | 2 +- syncer/move.go | 2 +- syncer/sync.go | 2 +- uploader/copy.go | 2 +- uploader/dedupe.go | 2 +- uploader/move.go | 4 ++-- 8 files changed, 8 insertions(+), 39 deletions(-) delete mode 100644 rclone/helpers.go diff --git a/rclone/helpers.go b/rclone/helpers.go deleted file mode 100644 index 003c455..0000000 --- a/rclone/helpers.go +++ /dev/null @@ -1,31 +0,0 @@ -package rclone - -import "strings" - -func FormattedParams(params []string) []string { - var formattedParams []string - - for _, p := range params { - // does p contain = - pos := strings.Index(p, "=") - if pos < 0 { - // no = found, add it as-is - formattedParams = append(formattedParams, p) - continue - } - - // split p into param name and value - pn := p[:pos] - pv := p[pos+1:] - - if pn == "" || pv == "" { - // failed to parse name and value - log.Warnf("Failed formatting argument into name / value: %q, ignoring...", p) - continue - } - - formattedParams = append(formattedParams, pn, pv) - } - - return formattedParams -} diff --git a/syncer/copy.go b/syncer/copy.go index d53664b..e0dc310 100644 --- a/syncer/copy.go +++ b/syncer/copy.go @@ -13,7 +13,7 @@ import ( func (s *Syncer) Copy(additionalRcloneParams []string) error { // set variables - extraParams := rclone.FormattedParams(s.Config.RcloneParams.Copy) + extraParams := s.Config.RcloneParams.Copy if additionalRcloneParams != nil { extraParams = append(extraParams, additionalRcloneParams...) } diff --git a/syncer/dedupe.go b/syncer/dedupe.go index 89270d5..d2ffbb9 100644 --- a/syncer/dedupe.go +++ b/syncer/dedupe.go @@ -8,7 +8,7 @@ import ( ) func (s *Syncer) Dedupe(additionalRcloneParams []string) error { - extraParams := rclone.FormattedParams(s.Config.RcloneParams.Dedupe) + extraParams := s.Config.RcloneParams.Dedupe if additionalRcloneParams != nil { extraParams = append(extraParams, additionalRcloneParams...) } diff --git a/syncer/move.go b/syncer/move.go index 8e8fa9a..2d010c1 100644 --- a/syncer/move.go +++ b/syncer/move.go @@ -19,7 +19,7 @@ func (s *Syncer) Move(additionalRcloneParams []string) error { }) } - extraParams := rclone.FormattedParams(s.Config.RcloneParams.MoveServerSide) + extraParams := s.Config.RcloneParams.MoveServerSide if additionalRcloneParams != nil { extraParams = append(extraParams, additionalRcloneParams...) } diff --git a/syncer/sync.go b/syncer/sync.go index d97cb4b..1668141 100644 --- a/syncer/sync.go +++ b/syncer/sync.go @@ -13,7 +13,7 @@ import ( func (s *Syncer) Sync(additionalRcloneParams []string) error { // set variables - extraParams := rclone.FormattedParams(s.Config.RcloneParams.Sync) + extraParams := s.Config.RcloneParams.Sync if additionalRcloneParams != nil { extraParams = append(extraParams, additionalRcloneParams...) } diff --git a/uploader/copy.go b/uploader/copy.go index 3e644af..c6d2f57 100644 --- a/uploader/copy.go +++ b/uploader/copy.go @@ -13,7 +13,7 @@ import ( func (u *Uploader) Copy(additionalRcloneParams []string) error { // set variables - extraParams := rclone.FormattedParams(u.Config.RcloneParams.Copy) + extraParams := u.Config.RcloneParams.Copy if additionalRcloneParams != nil { extraParams = append(extraParams, additionalRcloneParams...) } diff --git a/uploader/dedupe.go b/uploader/dedupe.go index 3e300d0..409662f 100644 --- a/uploader/dedupe.go +++ b/uploader/dedupe.go @@ -8,7 +8,7 @@ import ( ) func (u *Uploader) Dedupe(additionalRcloneParams []string) error { - extraParams := rclone.FormattedParams(u.Config.RcloneParams.Dedupe) + extraParams := u.Config.RcloneParams.Dedupe if additionalRcloneParams != nil { extraParams = append(extraParams, additionalRcloneParams...) } diff --git a/uploader/move.go b/uploader/move.go index 51493d9..4b6eb04 100644 --- a/uploader/move.go +++ b/uploader/move.go @@ -26,7 +26,7 @@ func (u *Uploader) Move(serverSide bool, additionalRcloneParams []string) error }) } - extraParams = rclone.FormattedParams(u.Config.RcloneParams.MoveServerSide) + extraParams = u.Config.RcloneParams.MoveServerSide } else { // this is a normal move (to only one location) moveRemotes = append(moveRemotes, rclone.RemoteInstruction{ @@ -35,7 +35,7 @@ func (u *Uploader) Move(serverSide bool, additionalRcloneParams []string) error ServerSide: false, }) - extraParams = rclone.FormattedParams(u.Config.RcloneParams.Move) + extraParams = u.Config.RcloneParams.Move } // set variables