Skip to content

Commit 9f1d1d9

Browse files
committed
Only warn if files are present and invalid, not just missing
1 parent 020661a commit 9f1d1d9

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## 14.5.2 - 2024-01-22
9+
10+
### Changed
11+
12+
* Suppressed mailbox and metadata '...is invalid' messages when these
13+
files are missing. Now, the messages are printed when a file is
14+
actually malformed.
15+
816
## 14.5.1 - 2024-01-18
917

1018
### Changed

lib/imap/backup/serializer.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ def validate!
102102
@validated = true
103103
return true
104104
end
105-
Logger.logger.info("Metadata file '#{imap.pathname}' is invalid") if !imap_valid
106-
Logger.logger.info("Mailbox '#{mbox.pathname}' is invalid") if !mbox_valid
105+
warn_imap = !imap_valid && imap.exist?
106+
Logger.logger.info("Metadata file '#{imap.pathname}' is invalid") if warn_imap
107+
warn_mbox = !mbox_valid && mbox.exist?
108+
Logger.logger.info("Mailbox '#{mbox.pathname}' is invalid") if warn_mbox
107109

108110
delete
109111

lib/imap/backup/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Imap::Backup
66
# @private
77
MINOR = 5
88
# @private
9-
REVISION = 1
9+
REVISION = 2
1010
# @private
1111
PRE = nil
1212
# The application version

spec/unit/serializer_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
before do
2424
allow(imap).to receive(:pathname) { "imap pathname" }
2525
allow(imap).to receive(:valid?) { imap_valid }
26+
allow(imap).to receive(:exist?) { true }
2627
allow(imap).to receive(:delete)
2728
allow(mbox).to receive(:pathname) { "mbox pathname" }
2829
allow(mbox).to receive(:valid?) { mbox_valid }
30+
allow(mbox).to receive(:exist?) { true }
2931
allow(mbox).to receive(:delete)
3032

3133
action.call

0 commit comments

Comments
 (0)