mirror of
https://github.com/rclone/rclone
synced 2025-01-12 15:46:25 +01:00
cache: fix error return value of cache/fetch rc method
This commit is contained in:
parent
a4c4019032
commit
deda093637
10
backend/cache/cache.go
vendored
10
backend/cache/cache.go
vendored
@ -666,7 +666,7 @@ func (f *Fs) rcFetch(in rc.Params) (rc.Params, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
type fileStatus struct {
|
type fileStatus struct {
|
||||||
Error error
|
Error string
|
||||||
FetchedChunks int
|
FetchedChunks int
|
||||||
}
|
}
|
||||||
fetchedChunks := make(map[string]fileStatus, len(files))
|
fetchedChunks := make(map[string]fileStatus, len(files))
|
||||||
@ -675,13 +675,13 @@ func (f *Fs) rcFetch(in rc.Params) (rc.Params, error) {
|
|||||||
var status fileStatus
|
var status fileStatus
|
||||||
o, err := f.NewObject(remote)
|
o, err := f.NewObject(remote)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
status.Error = err
|
fetchedChunks[file] = fileStatus{Error: err.Error()}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
co := o.(*Object)
|
co := o.(*Object)
|
||||||
err = co.refreshFromSource(true)
|
err = co.refreshFromSource(true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
status.Error = err
|
fetchedChunks[file] = fileStatus{Error: err.Error()}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
handle := NewObjectHandle(co, f)
|
handle := NewObjectHandle(co, f)
|
||||||
@ -690,8 +690,8 @@ func (f *Fs) rcFetch(in rc.Params) (rc.Params, error) {
|
|||||||
walkChunkRanges(crs, co.Size(), func(chunk int64) {
|
walkChunkRanges(crs, co.Size(), func(chunk int64) {
|
||||||
_, err := handle.getChunk(chunk * f.ChunkSize())
|
_, err := handle.getChunk(chunk * f.ChunkSize())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if status.Error == nil {
|
if status.Error == "" {
|
||||||
status.Error = err
|
status.Error = err.Error()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
status.FetchedChunks++
|
status.FetchedChunks++
|
||||||
|
Loading…
Reference in New Issue
Block a user