From df176c30a833bd8dd7d5ee6d90f7237d2f6d9570 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 27 May 2015 15:31:47 -0700 Subject: [PATCH] Fix a nil reference remove erroneous usage of url.Parse() use client.Parse(), unexport progress() method --- cp-bar.go | 4 ++-- cp-url.go | 3 +-- pkg/client/fs/fs.go | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cp-bar.go b/cp-bar.go index 7d9f9239..3aa1bffd 100644 --- a/cp-bar.go +++ b/cp-bar.go @@ -41,7 +41,7 @@ type copyReader struct { func (r *copyReader) Read(p []byte) (n int, err error) { n, err = r.Reader.Read(p) - r.bar.Progress(int64(n)) + r.bar.progress(int64(n)) return } @@ -59,7 +59,7 @@ func (b barSend) Extend(total int64) { b.cmdCh <- barMsg{Cmd: cpBarCmdExtend, Arg: total} } -func (b barSend) Progress(progress int64) { +func (b barSend) progress(progress int64) { b.cmdCh <- barMsg{Cmd: cpBarCmdProgress, Arg: progress} } diff --git a/cp-url.go b/cp-url.go index 0c7ec6c6..456c931c 100644 --- a/cp-url.go +++ b/cp-url.go @@ -19,7 +19,6 @@ package main import ( "errors" "fmt" - "net/url" "path/filepath" "strings" @@ -193,7 +192,7 @@ func prepareCopyURLsTypeA(sourceURL string, targetURL string) *cpURLs { return &cpURLs{Error: iodine.New(errInvalidTarget{path: targetURL}, nil)} } // if target is same Name, Size and Type as source return error and skip - u, _ := url.Parse(targetContent.Name) + u, _ := client.Parse(targetContent.Name) if (targetContent.Size == sourceContent.Size) && (filepath.Base(u.Path) == sourceContent.Name) { // Target exists, don't overwrite. Let the copy function decide return error here return &cpURLs{Error: iodine.New(errSameURLs{source: sourceURL, target: targetURL}, nil)} diff --git a/pkg/client/fs/fs.go b/pkg/client/fs/fs.go index 6848babe..e6790c8b 100644 --- a/pkg/client/fs/fs.go +++ b/pkg/client/fs/fs.go @@ -221,7 +221,7 @@ func (f *fsClient) listInRoutine(contentCh chan client.ContentOnChannel) { } default: content := &client.Content{ - Name: fi.Name(), + Name: f.path, Time: fi.ModTime(), Size: fi.Size(), Type: fi.Mode(),