forked from TrueCloudLab/restic
backend: Deduplicate sanity checks for parameters of Load() method
The check is now handled by backend.DefaultLoad. This also guarantees consistent behavior across all backends.
This commit is contained in:
parent
bdcafbc11c
commit
8bfc2519d7
9 changed files with 10 additions and 71 deletions
|
@ -144,17 +144,6 @@ func (be *beSwift) Load(ctx context.Context, h restic.Handle, length int, offset
|
|||
|
||||
func (be *beSwift) openReader(ctx context.Context, h restic.Handle, length int, offset int64) (io.ReadCloser, error) {
|
||||
debug.Log("Load %v, length %v, offset %v", h, length, offset)
|
||||
if err := h.Valid(); err != nil {
|
||||
return nil, backoff.Permanent(err)
|
||||
}
|
||||
|
||||
if offset < 0 {
|
||||
return nil, errors.New("offset is negative")
|
||||
}
|
||||
|
||||
if length < 0 {
|
||||
return nil, errors.Errorf("invalid length %d", length)
|
||||
}
|
||||
|
||||
objName := be.Filename(h)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue