Skip to content

Commit

Permalink
Only warn if files are present and invalid, not just missing
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyates committed Jan 22, 2024
1 parent 020661a commit 9f1d1d9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 14.5.2 - 2024-01-22

### Changed

* Suppressed mailbox and metadata '...is invalid' messages when these
files are missing. Now, the messages are printed when a file is
actually malformed.

## 14.5.1 - 2024-01-18

### Changed
Expand Down
6 changes: 4 additions & 2 deletions lib/imap/backup/serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ def validate!
@validated = true
return true
end
Logger.logger.info("Metadata file '#{imap.pathname}' is invalid") if !imap_valid
Logger.logger.info("Mailbox '#{mbox.pathname}' is invalid") if !mbox_valid
warn_imap = !imap_valid && imap.exist?
Logger.logger.info("Metadata file '#{imap.pathname}' is invalid") if warn_imap
warn_mbox = !mbox_valid && mbox.exist?
Logger.logger.info("Mailbox '#{mbox.pathname}' is invalid") if warn_mbox

delete

Expand Down
2 changes: 1 addition & 1 deletion lib/imap/backup/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Imap::Backup
# @private
MINOR = 5
# @private
REVISION = 1
REVISION = 2
# @private
PRE = nil
# The application version
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/serializer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
before do
allow(imap).to receive(:pathname) { "imap pathname" }
allow(imap).to receive(:valid?) { imap_valid }
allow(imap).to receive(:exist?) { true }
allow(imap).to receive(:delete)
allow(mbox).to receive(:pathname) { "mbox pathname" }
allow(mbox).to receive(:valid?) { mbox_valid }
allow(mbox).to receive(:exist?) { true }
allow(mbox).to receive(:delete)

action.call
Expand Down

0 comments on commit 9f1d1d9

Please sign in to comment.