mirror of
https://github.com/restic/restic.git
synced 2025-11-14 23:22:49 +00:00
Fix inconsistency of saving/loading config file
Fix saving/loading config file: Always set ID to a zero ID.
This commit is contained in:
committed by
Alexander Weiss
parent
dd7b4f54f5
commit
d3c59d18e5
@@ -82,6 +82,10 @@ func (r *Repository) LoadAndDecrypt(ctx context.Context, buf []byte, t restic.Fi
|
||||
|
||||
debug.Log("load %v with id %v", t, id)
|
||||
|
||||
if t == restic.ConfigFile {
|
||||
id = restic.ID{}
|
||||
}
|
||||
|
||||
h := restic.Handle{Type: t, Name: id.String()}
|
||||
err := r.be.Load(ctx, h, 0, 0, func(rd io.Reader) error {
|
||||
// make sure this call is idempotent, in case an error occurs
|
||||
@@ -295,7 +299,11 @@ func (r *Repository) SaveUnpacked(ctx context.Context, t restic.FileType, p []by
|
||||
|
||||
ciphertext = r.key.Seal(ciphertext, nonce, p, nil)
|
||||
|
||||
id = restic.Hash(ciphertext)
|
||||
if t == restic.ConfigFile {
|
||||
id = restic.ID{}
|
||||
} else {
|
||||
id = restic.Hash(ciphertext)
|
||||
}
|
||||
h := restic.Handle{Type: t, Name: id.String()}
|
||||
|
||||
err = r.be.Save(ctx, h, restic.NewByteReader(ciphertext))
|
||||
|
||||
Reference in New Issue
Block a user