diff --git a/CHANGELOG.md b/CHANGELOG.md index a16fcb0a..7d931e6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Fixed - Auto-update mechanism of IRMA configuration not working in ghcr.io/privacybydesign/irma Docker container +- Panics occur when the timestamp file does not exist in a scheme directory ## [0.13.2] - 2023-08-22 ### Changed diff --git a/schemes.go b/schemes.go index d226e28a..007c4606 100644 --- a/schemes.go +++ b/schemes.go @@ -395,8 +395,11 @@ func (conf *Configuration) parseSchemeDescription(dir string) (Scheme, SchemeMan var ts *Timestamp ts, exists, err = readTimestamp(filepath.Join(dir, "timestamp")) - if err != nil || !exists { - return scheme, SchemeManagerStatusParsingError, WrapErrorPrefix(err, "Could not read scheme manager timestamp") + if err != nil { + return scheme, SchemeManagerStatusParsingError, WrapErrorPrefix(err, "could not read scheme manager timestamp") + } + if !exists { + return scheme, SchemeManagerStatusParsingError, errors.New("scheme manager timestamp not found") } scheme.setTimestamp(*ts) @@ -630,9 +633,13 @@ func (conf *Configuration) isUpToDate(subdir string) (bool, error) { return true, nil } newTime, exists, err := readTimestamp(filepath.Join(conf.assets, subdir, "timestamp")) - if err != nil || !exists { - return true, WrapErrorPrefix(err, "Could not read asset timestamp of scheme "+subdir) + if err != nil { + return true, WrapErrorPrefix(err, "could not read asset timestamp of scheme "+subdir) + } + if !exists { + return true, errors.Errorf("no timestamp found for scheme %s", subdir) } + // The storage version of the manager does not need to have a timestamp. If it does not, it is outdated. oldTime, exists, err := readTimestamp(filepath.Join(conf.Path, subdir, "timestamp")) if err != nil {