From 5c0a1ef8199ddf0983abeaf1cfeef8ff4a5b9c0b Mon Sep 17 00:00:00 2001
From: Yuri Konotopov <ykonotopov@gnome.org>
Date: Thu, 31 Jul 2025 20:32:09 +0000
Subject: [PATCH] repository: fix signature verification using binary .gpg
 files
Forwarded: https://gitlab.com/apt-mirror2/apt-mirror2/-/merge_requests/215
Applied-Upstream: https://gitlab.com/apt-mirror2/apt-mirror2/-/commit/5c0a1ef8199ddf0983abeaf1cfeef8ff4a5b9c0b

---
 apt_mirror/repository.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/apt_mirror/repository.py b/apt_mirror/repository.py
index b9d117f..4702dca 100644
--- a/apt_mirror/repository.py
+++ b/apt_mirror/repository.py
@@ -741,9 +741,12 @@ class BaseRepository(ABC):
                     with open(file, "rb") as fp:
                         header = fp.read(1)
 
+                        if len(header) != 1:
+                            continue
+
                         # OpenPGP public key packets
                         # https://salsa.debian.org/apt-team/apt/-/blob/63919b628a9bf386136f708f06c1a8a7d4f09fca/apt-pkg/contrib/gpgv.cc#L352
-                        if header not in (0x98, 0x99, 0xC6):
+                        if header[0] not in (0x98, 0x99, 0xC6):
                             continue
 
                         keyring.write(header)
-- 
GitLab

