forked from pool/python-HyperKitty
downloads on mails with empty attachments OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:mailman/python-HyperKitty?expand=0&rev=86
32 lines
1.0 KiB
Diff
32 lines
1.0 KiB
Diff
From eb67c2fc470b88385f63435a826d73b32fc3c226 Mon Sep 17 00:00:00 2001
|
|
From: Mark Sapiro <mark@msapiro.net>
|
|
Date: Mon, 15 Jul 2024 17:44:59 -0700
|
|
Subject: [PATCH] Return null bytes for empty attachment get_content.
|
|
|
|
---
|
|
hyperkitty/models/email.py | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/hyperkitty/models/email.py b/hyperkitty/models/email.py
|
|
index 651694e5..12732a93 100644
|
|
--- a/hyperkitty/models/email.py
|
|
+++ b/hyperkitty/models/email.py
|
|
@@ -329,12 +329,12 @@ class Attachment(models.Model):
|
|
if self.content is not None:
|
|
return bytes(self.content)
|
|
if folder is None:
|
|
- return ""
|
|
+ return b''
|
|
filepath = os.path.join(folder, str(self.counter))
|
|
if not os.path.exists(filepath):
|
|
logger.error("Could not find local attachment %s for email %s",
|
|
self.counter, self.email.id)
|
|
- return ""
|
|
+ return b''
|
|
with open(filepath, "rb") as f:
|
|
content = f.read()
|
|
return content
|
|
--
|
|
GitLab
|
|
|