diff --git a/app/handler/dmarc.py b/app/handler/dmarc.py index fc1a2d17b..895fa7036 100644 --- a/app/handler/dmarc.py +++ b/app/handler/dmarc.py @@ -30,7 +30,9 @@ def apply_dmarc_policy_for_forward_phase( ) -> Tuple[Message, Optional[str]]: spam_result = SpamdResult.extract_from_headers(msg, Phase.forward) if not DMARC_CHECK_ENABLED or not spam_result: + LOG.i("DMARC check disabled") return msg, None + LOG.i(f"Spam check result in {spam_result}") from_header = get_header_unicode(msg[headers.FROM]) @@ -150,8 +152,10 @@ def apply_dmarc_policy_for_reply_phase( ) -> Optional[str]: spam_result = SpamdResult.extract_from_headers(msg, Phase.reply) if not DMARC_CHECK_ENABLED or not spam_result: + LOG.i("DMARC check disabled") return None + LOG.i(f"Spam check result is {spam_result}") if spam_result.dmarc not in ( DmarcCheckResult.quarantine, DmarcCheckResult.reject, diff --git a/app/import_utils.py b/app/import_utils.py index 9d4460e3b..6cb30cc04 100644 --- a/app/import_utils.py +++ b/app/import_utils.py @@ -30,7 +30,10 @@ def handle_batch_import(batch_import: BatchImport): LOG.d("Download file %s from %s", batch_import.file, file_url) r = requests.get(file_url) - lines = [line.decode("utf-8") for line in r.iter_lines()] + # Replace invisible character + lines = [ + line.decode("utf-8").replace("\ufeff", "").strip() for line in r.iter_lines() + ] import_from_csv(batch_import, user, lines)