diff --git a/cp-url.go b/cp-url.go index 53c6ac89..dec8f02a 100644 --- a/cp-url.go +++ b/cp-url.go @@ -53,13 +53,6 @@ type copyURLs struct { Error error } -func (c copyURLs) IsEmpty() bool { - if c.SourceContent == nil && c.TargetContent == nil { - return true - } - return false -} - type copyURLsType uint8 const ( diff --git a/sync-url.go b/sync-url.go index 7da50ffe..656bcd88 100644 --- a/sync-url.go +++ b/sync-url.go @@ -17,6 +17,7 @@ package main import ( + "os" "path/filepath" "strings" @@ -30,22 +31,6 @@ type syncURLs struct { Error error `json:"-"` } -func (s syncURLs) IsEmpty() bool { - empty := false - if s.SourceContent == nil { - empty = true - if s.TargetContents == nil { - empty = true - return empty - } - if len(s.TargetContents) > 0 && s.TargetContents[0] == nil { - empty = true - return empty - } - } - return empty -} - type syncURLsType uint8 const ( @@ -149,6 +134,10 @@ func prepareSingleSyncURLsTypeB(sourceURL string, targetURL string) syncURLs { } _, targetContent, err := url2Stat(targetURL) + if os.IsNotExist(iodine.ToError(err)) { + // Source and target are files. Already reduced to Type A. + return prepareSingleSyncURLsTypeA(sourceURL, targetURL) + } if err != nil { return syncURLs{Error: NewIodine(iodine.New(err, nil))} }