mirror of
https://github.com/simple-login/app.git
synced 2024-09-30 05:31:30 +02:00
save the data for debugging when pgp fails
This commit is contained in:
parent
83f3309149
commit
477481c41e
@ -60,6 +60,12 @@ def encrypt_file(data: BytesIO, fingerprint: str) -> str:
|
|||||||
r = gpg.encrypt_file(data, fingerprint, always_trust=True)
|
r = gpg.encrypt_file(data, fingerprint, always_trust=True)
|
||||||
|
|
||||||
if not r.ok:
|
if not r.ok:
|
||||||
raise PGPException(f"Cannot encrypt, status: {r.status}")
|
# save the data for debugging
|
||||||
|
data.seek(0)
|
||||||
|
file_path = f"/tmp/{random_string(10)}.eml"
|
||||||
|
with open(file_path, "wb") as f:
|
||||||
|
f.write(data.getbuffer())
|
||||||
|
|
||||||
|
raise PGPException(f"Cannot encrypt, status: {r.status}, {file_path}")
|
||||||
|
|
||||||
return str(r)
|
return str(r)
|
||||||
|
Loading…
Reference in New Issue
Block a user