Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

b64push: keep chunks a multiple of 3 bytes

Mustafa Ahmed9f38e19a0cfb
diff --git a/tools/b64push.py b/tools/b64push.py
index 966cfd7ac..02ff01d58 100644
--- a/tools/b64push.py
+++ b/tools/b64push.py
@@ -22,6 +22,7 @@ def main():
want = hashlib.md5(data).hexdigest()
dev = tv.connect()
chunk = min(CHUNK, dev.max_chunk_size * 3 // 4 - 64) # base64 of the chunk plus the echo must fit one payload
+ chunk -= chunk % 3 # a multiple of 3, or each chunk ends in '=' padding mid-stream and base64 -d corrupts it
tmp = remote + ".b64"
dev.shell(f"rm -f {remote} {tmp}")
n = (len(data) + chunk - 1) // chunk