Fix base64 padding error in migration script
This commit is contained in:
@@ -1463,11 +1463,17 @@ class Converter:
|
|||||||
blob_b64 = sub.get("cert", "").strip()
|
blob_b64 = sub.get("cert", "").strip()
|
||||||
if not blob_b64:
|
if not blob_b64:
|
||||||
continue
|
continue
|
||||||
try:
|
padded = blob_b64 + "=" * (-len(blob_b64) % 4)
|
||||||
blob = base64.b64decode(blob_b64).decode("latin-1")
|
blob = None
|
||||||
except Exception as exc:
|
for decoder in (base64.b64decode, base64.urlsafe_b64decode):
|
||||||
|
try:
|
||||||
|
blob = decoder(padded).decode("latin-1")
|
||||||
|
break
|
||||||
|
except Exception as exc:
|
||||||
|
last_err = exc
|
||||||
|
if blob is None:
|
||||||
print(
|
print(
|
||||||
f"warning: skipping acme.{sid}: base64 decode failed: {exc}",
|
f"warning: skipping acme.{sid}: base64 decode failed: {last_err}",
|
||||||
file=sys.stderr,
|
file=sys.stderr,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user