mirror of
https://github.com/octoleo/restic.git
synced 2024-11-04 20:37:49 +00:00
repository: remove GetDecryptReader()
This commit is contained in:
parent
3191778d33
commit
782a1bf7b0
@ -1,6 +1,7 @@
|
|||||||
package repository
|
package repository
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -564,13 +565,12 @@ func LoadIndexWithDecoder(repo *Repository, id string, fn func(io.Reader) (*Inde
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
rd, err := repo.GetDecryptReader(backend.Index, idxID.String())
|
buf, err := repo.LoadAndDecrypt(backend.Index, idxID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer closeOrErr(rd, &err)
|
|
||||||
|
|
||||||
idx, err = fn(rd)
|
idx, err = fn(bytes.NewReader(buf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
debug.Log("LoadIndexWithDecoder", "error while decoding index %v: %v", id, err)
|
debug.Log("LoadIndexWithDecoder", "error while decoding index %v: %v", id, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -495,17 +495,6 @@ func LoadIndex(repo *Repository, id string) (*Index, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDecryptReader opens the file id stored in the backend and returns a
|
|
||||||
// reader that yields the decrypted content. The reader must be closed.
|
|
||||||
func (r *Repository) GetDecryptReader(t backend.Type, id string) (io.ReadCloser, error) {
|
|
||||||
rd, err := r.be.GetReader(t, id, 0, 0)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return newDecryptReadCloser(r.key, rd)
|
|
||||||
}
|
|
||||||
|
|
||||||
// SearchKey finds a key with the supplied password, afterwards the config is
|
// SearchKey finds a key with the supplied password, afterwards the config is
|
||||||
// read and parsed.
|
// read and parsed.
|
||||||
func (r *Repository) SearchKey(password string) error {
|
func (r *Repository) SearchKey(password string) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user