Fix a nil reference remove erroneous usage of url.Parse() use client.Parse(), unexport progress() method

This commit is contained in:
Harshavardhana
2015-05-27 15:32:17 -07:00
parent d80f63ea38
commit df176c30a8
3 changed files with 4 additions and 5 deletions
+2 -2
View File
@@ -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}
}
+1 -2
View File
@@ -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)}
+1 -1
View File
@@ -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(),