Skip to contentSkip to conversation

b4: Fix offline mbox --check case

PATCH Applied David Nyström 2 participants 2 messages Oct 31, 2025 – Feb 24

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 b4: Fix offline mbox --check case

Without this patch:
--
b4 -d shazam --check -s [email protected]
● oe-checkpatch-dump.sh: Saved /tmp/b4-check-eenY4T.eml (6150 bytes)

b4 -d --offline-mode shazam --check -s -m openembedded-core.mbox \
[email protected]
Unable to get payload from message <[email protected]>
● oe-checkpatch-dump.sh: Saved /tmp/b4-check-YcwtJ7.eml (0 bytes)

With this patch:
--
b4 -d shazam --check -s [email protected]
● oe-checkpatch-dump.sh: Saved /tmp/b4-check-eenY4T.eml (6150 bytes)

b4 -d --offline-mode shazam --check -s -m openembedded-core.mbox \
[email protected]
● oe-checkpatch-dump.sh: Saved /tmp/b4-check-QzxXnn.eml (11806 bytes)

---
 src/b4/__init__.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
src/b4/__init__.py +3 -2
index 33fbc3f..29682ed 100644
@@ -1992,8 +1992,9 @@ class LoreMessage:
         bdata += nl.encode()
         payload = msg.get_payload(decode=True)
         if not isinstance(payload, bytes):
-            logger.critical('Unable to get payload from message %s', msg.get('Message-Id'))
-            return b''
+            # Ensure per-patch checkers always receive usable input even if from a local mbox
+            body_text, _charset = LoreMessage.get_payload(msg, use_patch=True)
+            payload = body_text.encode('utf-8', errors='replace')
         for bline in payload.split(b'\n'):
             bdata += re.sub(rb'[\r\n]*$', b'', bline) + nl.encode()
         return bdata
Signature · 1 line
2.48.1
#1 lore raw
Quoted 1 line · David Nyström

b4: Fix offline mbox --check case

Applied, thanks!

[1/1] b4: Fix offline mbox --check case

      commit: c5b9ed8d8209ca478459bbcc08d2beb07f1b2997

Best regards,

Signature · 1 line
KR