internal/format: improve error message for old header format (#398)

This commit is contained in:
Helio Machado
2022-04-26 19:30:35 +02:00
committed by GitHub
parent 3b4fb67296
commit d717942b93

View File

@@ -189,7 +189,7 @@ func Parse(input io.Reader) (*Header, io.Reader, error) {
if bytes.HasPrefix(line, footerPrefix) {
if r != nil {
return nil, nil, errorf("malformed body line %q: reached footer without previous stanza being closed\nNote: this might be a file encrypted with an old beta version of rage. Use rage to decrypt it.", line)
return nil, nil, errorf("malformed body line %q: reached footer without previous stanza being closed\nNote: this might be a file encrypted with an old beta version of age or rage. Use age v1.0.0-beta6 or rage to decrypt it.", line)
}
prefix, args := splitArgs(line)
if prefix != string(footerPrefix) || len(args) != 1 {
@@ -203,7 +203,7 @@ func Parse(input io.Reader) (*Header, io.Reader, error) {
} else if bytes.HasPrefix(line, recipientPrefix) {
if r != nil {
return nil, nil, errorf("malformed body line %q: new stanza started without previous stanza being closed\nNote: this might be a file encrypted with an old beta version of rage. Use rage to decrypt it.", line)
return nil, nil, errorf("malformed body line %q: new stanza started without previous stanza being closed\nNote: this might be a file encrypted with an old beta version of age or rage. Use age v1.0.0-beta6 or rage to decrypt it.", line)
}
r = &Stanza{}
prefix, args := splitArgs(line)